You are here

Hotkeys in NSIS

5 posts / 0 new
Last post
Pyromaniac
Pyromaniac's picture
Offline
Last seen: 9 years 2 weeks ago
Developer
Joined: 2008-09-30 19:18
Hotkeys in NSIS

So, I'm trying to make an app in NSIS that will act according to a certain hotkey that's pressed (in this case, alt + b). I think I've got the register/unregister part down, but I don't know how to store whatever was pressed into $var, then I can do what I need to from there...

I've never used the system plugin (or GetDlgItem for that matter), nor have I registered hotkeys, but I found a couple of tutorials on how to use the system plugin (from the manual), and how to register hotkeys (from MSDN).

So far, I got this from guessing and checking:

GetDlgItem $0 $HWNDPARENT 1
MessageBox MB_OK "$0" ; returns random numeber

System::Call 'User32::RegisterHotKey(l $0, i 1, t MOD_ALT, t 0x42) i .r2'
MessageBox MB_OK "$2" ; returns nonzero (good) (1 for me)

; Store whatever's pressed then do stuff

;(other stuff)

; And then:
	
System::Call 'User32::UnregisterHotKey(l $0, i 1) i .r2'
MessageBox MB_OK "$2" ; returns nonzero (good) (1 for me)

I've searched google forever and have still been unsuccessful, so any help would be awesome :D.

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 10 months ago
Joined: 2007-04-15 21:08
Not fit for purpose

You're using NSIS for something that it was never meant for and you're having to do a mighty large lot of bending to get it into shape. And you'll be struggling against it the whole way. My advice is to give it up and use something like Python plus PyQt4/PySide (what I'm using in the Development Toolkit).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

TaffinFoxcroft
TaffinFoxcroft's picture
Offline
Last seen: 10 years 4 months ago
Developer
Joined: 2006-12-14 17:24
NSIS is an installer

NSIS is an installer language, if you've managed to get it to do anything with hotkeys so far I salute you. You may find it a little easier though to use something like AutoHotkey, which was built with ease of use and hotkeys in mind. Let us know what you come up with though, I'd like to see the end result Smile

But there’s no sense crying over every mistake,
You just keep on trying till you run out of cake.

xuesheng
Offline
Last seen: 3 months 4 days ago
Joined: 2008-03-21 15:34
Try NSIS forum?

A quick search of the NSIS Discussion Forum found this topic:
http://forums.winamp.com/showthread.php?t=310224

Edit: Another idea is to use the standard nsDialogs plugin and create a hidden control to handle the hotkey. See the nsDialogs FAQ at http://nsis.sourceforge.net/NsDialogs_FAQ

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 9 years 2 weeks ago
Developer
Joined: 2008-09-30 19:18
thanks

I found a similar NSIS discussion in the winamp forums, which gave me the idea to use the system plugin, but I think the NsDialogs is more appealing to learn.

Thanks!

Log in or register to post comments