- NSIS Discussion
- Hotkey Function Request
Archive: Hotkey Function Request
jwhough
14th June 2011 03:23 UTC
Hotkey Function Request
Hi,
I was wondering if someone could make a basic plugin that would call a function whenever a hotkey is pressed. I've scoured the web in search of a solution and thought I found one with this but it only worked when the window was open. I want a system-wide hotkey function that will work, including when the installer is minimized with NotifyIcon. I also looked at this other topic but I couldn't follow it. I would have posted in the Feature Requests tracker, but I was thinking I could get it faster if asked here.
Thanks in advance,
jw
MSG
14th June 2011 06:48 UTC
As interesting as this idea is, are you sure that this is necessary? An installer is only run once, during installation. What's the added value of global hotkey support in something the user only uses one time in their OS lifetime? Considering that the hotkey support has to be explained to the user (adding to user confusion) and that this introduces one more point for things to go wrong (it's not a trivial affair so cross-OS support may be a problem), why bother introducing such a feature when its use is only very very small?
T.Slappy
14th June 2011 07:01 UTC
Maybe he means something like pressing Enter to continue on next page?
This is already implemented, so as standard Ctrl+C for text etc...
MSG
14th June 2011 12:00 UTC
He asks for global hotkeys specifically, so not what you're thinking about.
jwhough
14th June 2011 22:26 UTC
Not an installer
I probably should have specified that I'm not writing an installer, but a whole program in NSIS. Here's some (outdated) screenshots:
First One
Second One
I know NSIS isn't the best language to do this kind of stuff, but the only other language I know is Java, but I don't know how to do much with it. I just feel more comfortable with NSIS.
Oh, and I forgot to mention, could this be in ANSI? I'd do Unicode, but some of the plugins are ANSI only.
T.Slappy
15th June 2011 08:44 UTC
Originally posted by jwhough
I probably should have specified that I'm not writing an installer, but a whole program in NSIS. Here's some (outdated) screenshots:
First One
Second One
I know NSIS isn't the best language to do this kind of stuff, but the only other language I know is Java, but I don't know how to do much with it. I just feel more comfortable with NSIS.
Oh, and I forgot to mention, could this be in ANSI? I'd do Unicode, but some of the plugins are ANSI only.
Actually this is quit normal idea, I made also several tools with NSIS :)
It is like new-simple-script-programming language.
MSG
15th June 2011 12:26 UTC
Using NSIS to create a memory-resident background app is... Well, kind of silly. But yeah, whatever rocks your boat I guess. My point remains that a global hotkey plugin is probably much more trouble than it's worth, because NSIS is for making installers and installers shouldn't need it.
Anders
15th June 2011 15:11 UTC
Well there is a tray plugin so it is not like we already don't have "useless" plugins.
Anyway, your best option is to write a new plugin, the other option is to use the subclass plugin, but that requires a bit of work and win32 knowledge.
jwhough
15th June 2011 17:13 UTC
I was able, however to register a hotkey using the System plugin:
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)
All I need to do is figure out how to catch whenever somebody activates the hotkey.
jwhough
15th June 2011 17:41 UTC
Scratch everything.
I decided I'll just write a script in autohotkey, which I'm teaching myself atm.
And if anyone by chance started this, thanks, but I think I'll manage ;)
T.Slappy
16th June 2011 07:21 UTC
Originally posted by MSG
Using NSIS to create a memory-resident background app is... Well, kind of silly. But yeah, whatever rocks your boat I guess. My point remains that a global hotkey plugin is probably much more trouble than it's worth, because NSIS is for making installers and installers shouldn't need it.
Yeah, it is a really silly :)
This reminds me some game made with Startcraft 2 editor.
The game was a FPS, it is fantastic what can be done with simple tools....
Also few years ago I saw a chess built on Quake engine, it was totally useless but awesome!