SteveO Posted July 2, 2008 Share Posted July 2, 2008 I just wanna know how you guys would deal with this. I've got 2 autoit programs that I need to run at the same time. One is a posting script, the other is a countdown timer. I've got them both set to ctrl + d, but only the first program I open will run using ctrl + d. I don't want to merge the programs, because I need a responsive gui for the posting script, so I separated both scripts. Link to comment Share on other sites More sharing options...
mwpeck Posted July 2, 2008 Share Posted July 2, 2008 Pretty sure you cannot use the same hotkey for both because its intercepted by the first one and it doesnt get passed through to the second. Link to comment Share on other sites More sharing options...
ResNullius Posted July 2, 2008 Share Posted July 2, 2008 I just wanna know how you guys would deal with this. I've got 2 autoit programs that I need to run at the same time. One is a posting script, the other is a countdown timer. I've got them both set to ctrl + d, but only the first program I open will run using ctrl + d. I don't want to merge the programs, because I need a responsive gui for the posting script, so I separated both scripts.Check out GUISetAccelerators() Link to comment Share on other sites More sharing options...
SteveO Posted July 2, 2008 Author Share Posted July 2, 2008 Is it in another Autoit Update, because there's nothing about it in the autoit help file. Link to comment Share on other sites More sharing options...
ResNullius Posted July 2, 2008 Share Posted July 2, 2008 (edited) Is it in another Autoit Update, because there's nothing about it in the autoit help file.It was added in version 3.2.11.3.We're now on 3.2.12.1 release, and 3.2.13.3 beta.Edit: Also, you may still have to use HotKeys (in combination with Accelerators) as Accelerators only work with the currently active GUI window; so if one of your scripts just runs in the background and you don't actually activate the Gui before using the hotkey, then hotkey is the way to go for that script. Which brings up an interesting point: If you're running Accelerators and hotkeys from two different scripts, with the same keys assigned to both an accelerator and a hotkey function, which takes precedence? I'm thinking the hotkey, but it would bear some testing...Edit 2: Just finished testing and hotkey does take precedence over an Accelerator set to the same key combo.Guess you'll probably need to change the 2nd script's HotKey.BTW, we are talking about ctrl-d being set using AutoIt's HotKeySet() function aren't we?Or are you using Windows shortcut/hotkeys to launch the scripts using ctrl-d? Edited July 2, 2008 by ResNullius Link to comment Share on other sites More sharing options...
SteveO Posted July 2, 2008 Author Share Posted July 2, 2008 (edited) It was added in version 3.2.11.3.We're now on 3.2.12.1 release, and 3.2.13.3 beta.Edit: Also, you may still have to use HotKeys (in combination with Accelerators) as Accelerators only work with the currently active GUI window; so if one of your scripts just runs in the background and you don't actually activate the Gui before using the hotkey, then hotkey is the way to go for that script. Which brings up an interesting point: If you're running Accelerators and hotkeys from two different scripts, with the same keys assigned to both an accelerator and a hotkey function, which takes precedence? I'm thinking the hotkey, but it would bear some testing...Edit 2: Just finished testing and hotkey does take precedence over an Accelerator set to the same key combo.Guess you'll probably need to change the 2nd script's HotKey.BTW, we are talking about ctrl-d being set using AutoIt's HotKeySet() function aren't we?Or are you using Windows shortcut/hotkeys to launch the scripts using ctrl-d?Thanks for the reply and all the research. =) Yes we are talking about an autoit hotkey not a windows. I was thinking about using an INI file nad having the timer constantly check for a value in the INI, once the value is equal to 1 it starts, then it sets it back to 0. Once the timer hits o it'll go back into that checkign the INI loop. I'll try it tonight and update the thread to see if that worked for me. I think it should.Looks like I have to update my autoit too... Edited July 2, 2008 by SteveO Link to comment Share on other sites More sharing options...
cal Posted July 3, 2008 Share Posted July 3, 2008 You could try what I do. A Startup script (thats always running) has a hot key I use for alot of things. Mostly for small things and that it takes care of directly. I press the master hotkey, It checks what window is active and takes the needed action. A couple other scripts are like yours. I want to use the same master hotkey already in use, but don't want to put the code in my startup script. I've changed the hotkey for the secondary scripts to something like "ctrl alt a" for one and "ctrl alt b" for another. Then in the startup script I have it send these keys if one of its own case statements have not been found. The Secondary scripts in turn only do something if conditions are right. If those other scripts are not running then the "ctrl alt a" being sent out just won't have any effect. Not the best soln but it works. Recently I've discovered a combo of scripts if running that sometimes will hold the ctrl key down and therefor start screwing with things. So I've been thinking about using messages to make the scripts talk to each other and avoiding the extra key presses completely, but have not yet pursued that line of thought very far. Regarding "Accelerators" Thats new. never seen those before. So they are - like hotkeys you can set for a gui? - but only a gui I make right? - And they are active only if that gui is active? Is that correct? Sounds useful. It wont work for my startup stuff but I have a couple scripts where I can see this being a good method. Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted July 3, 2008 Share Posted July 3, 2008 another positive thing about the Accelerators it will not be detected as a keylogger.. Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
LinuZ Posted July 3, 2008 Share Posted July 3, 2008 I just wanna know how you guys would deal with this. I've got 2 autoit programs that I need to run at the same time. One is a posting script, the other is a countdown timer. I've got them both set to ctrl + d, but only the first program I open will run using ctrl + d. I don't want to merge the programs, because I need a responsive gui for the posting script, so I separated both scripts.Hey SteveO, you were the host guy from cryticalerror muttleyI don't fully understand what these hotkeys do, but if you need 2 programs to use 1 hotkey _IsPressed() function should be good Link to comment Share on other sites More sharing options...
SteveO Posted July 3, 2008 Author Share Posted July 3, 2008 You could try what I do. A Startup script (thats always running) has a hot key I use for alot of things. Mostly for small things and that it takes care of directly. I press the master hotkey, It checks what window is active and takes the needed action.A couple other scripts are like yours. I want to use the same master hotkey already in use, but don't want to put the code in my startup script. I've changed the hotkey for the secondary scripts to something like "ctrl alt a" for one and "ctrl alt b" for another. Then in the startup script I have it send these keys if one of its own case statements have not been found. The Secondary scripts in turn only do something if conditions are right. If those other scripts are not running then the "ctrl alt a" being sent out just won't have any effect.Not the best soln but it works. Recently I've discovered a combo of scripts if running that sometimes will hold the ctrl key down and therefor start screwing with things. So I've been thinking about using messages to make the scripts talk to each other and avoiding the extra key presses completely, but have not yet pursued that line of thought very far.Regarding "Accelerators"Thats new. never seen those before. So they are - like hotkeys you can set for a gui?- but only a gui I make right?- And they are active only if that gui is active?Is that correct? Sounds useful. It wont work for my startup stuff but I have a couple scripts where I can see this being a good method.Wow...I can't believe I didn't think of that.....It's so simple.another positive thing about the Acceleratorsit will not be detected as a keylogger..Really?Hey SteveO, you were the host guy from cryticalerror muttleyI don't fully understand what these hotkeys do, but if you need 2 programs to use 1 hotkey _IsPressed() function should be good Heh, Yep. Link to comment Share on other sites More sharing options...
ResNullius Posted July 4, 2008 Share Posted July 4, 2008 Regarding "Accelerators"Thats new. never seen those before. So they are - like hotkeys you can set for a gui?- but only a gui I make right?- And they are active only if that gui is active?Is that correct? Sounds useful. It wont work for my startup stuff but I have a couple scripts where I can see this being a good method.You got it. And for a clever use of them with Dummy Gui Controls, see Zedna's work here: http://www.autoitscript.com/forum/index.ph...st&p=493696 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now