Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   CreateShortcut - Hotkeys setting problem when using variables (http://forums.winamp.com/showthread.php?t=303273)

raj_kumar100 19th February 2009 17:45

CreateShortcut - Hotkeys setting problem when using variables
 
I am having problem setting hotkeys using CreateShortcut when using a variable for key combination.

The following code is not working (when hot key is set using a variable) this is raising a warning and when run it creates an hot key "NUM 7" instead of Alt+Ctrl+A

var HotKey (declared globally)

strcpy $HotKey "ALT|CONTROL|A"
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk" "$INSTDIR\Product.exe" "" "" "" "" "$HotKey"


Where as this code is working fine
CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME}.lnk" "$INSTDIR\Product.exe" "" "" "" "" "ALT|CONTROL|A"

Thanks

Animaether 19th February 2009 23:32

Looks like that's just one of those things that you have to set at compile time (much like the icon resource).

If this is not something that is changeable by the user in your installer, and you're merely using $HotKey to make it easier for coworkers/others to check the code, use '!define Hotkey "ALT|CONTROL|A"' and '${HotKey}' instead.

If it -is- something you want the user to be able to change on installation, then you may just have to get crazy with a whole string of Select/Case statements.. a la...
code:

${Select} $HotKey
${Case} A
CreateShortCut ... "ALT|CONTROL|A"
${Case} B
CreateShortCut ... "ALT|CONTROL|B"
...
${EndSelect}



Ouch, man.

Anders 19th February 2009 23:47

you could modify the hotkey after the shortcut has been created by calling the IShellLink COM interface with the system plugin

Animaether 20th February 2009 05:49

seems to be a plugin fit for the task as well..
http://nsis.sourceforge.net/ShellLin...rtcut_Hot_Keys

raj_kumar100 20th February 2009 07:09

Thanks for all reply ,

As suggested, I could do this using ShellLink plug-in, after creating a shortcut using CreateShortCut, I called ShellLink::SetShortCutHotkey to set the required hotkey


All times are GMT. The time now is 04:24.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.