SkyBlzr Posted May 14, 2008 Share Posted May 14, 2008 Hello, this is my first time useing Autoit. Mainly used AHK, but figured i'd give this a try. I was wondering if you could help me with this small script:- #include <Array.au3> Dim $avArray $avArray = _ArrayCreate("a","b","c") HotKeySet($avArray,"__1") While 1 Sleep(150) WEnd Func __1() Send("test",1) Send("{ENTER}") EndFunc Mainly I wanted it to check, if a, b or c was pressed. it would send test then Enter. But for some reason it doesn't read from the array list? mabe i'm doing something wrong.. Link to comment Share on other sites More sharing options...
monoceres Posted May 14, 2008 Share Posted May 14, 2008 You can't just pass the array to the HotKeySet function, it expects a single key. To set all the items in the array you must loop through it: Dim $keys[3]=["a","b","c"] For $key In $keys HotKeySet($key,"__1") Next while 1 sleep(150) WEnd Func __1 () Send("test",1) Send("{ENTER}") EndFunc Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 14, 2008 Share Posted May 14, 2008 Hello, this is my first time useing Autoit. Mainly used AHK, but figured i'd give this a try. I was wondering if you could help me with this small script:- #include <Array.au3> Dim $avArray $avArray = _ArrayCreate("a","b","c") HotKeySet($avArray,"__1") While 1 Sleep(150) WEnd Func __1() Send("test",1) Send("{ENTER}") EndFunc Mainly I wanted it to check, if a, b or c was pressed. it would send test then Enter. But for some reason it doesn't read from the array list? mabe i'm doing something wrong.. You can't set a hot key to the entire array. Specify which one you want, i.e. HotKeySet($avArray[1], "__1") ; sets hot key to "b". If want to set a hot key for all of them walk through the array in a loop. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
SkyBlzr Posted May 14, 2008 Author Share Posted May 14, 2008 Thank's for the help guys. ; -) Link to comment Share on other sites More sharing options...
SkyBlzr Posted May 14, 2008 Author Share Posted May 14, 2008 One more thing, sorry for the double post* is it possible, for example. if I press a, it will send 'a' from the array list and then send test {Enter}. Then same for b, c ect. At the moment, it ignores sending the letter. Seems to overwrite them or soemthing. Link to comment Share on other sites More sharing options...
monoceres Posted May 14, 2008 Share Posted May 14, 2008 One more thing, sorry for the double post* is it possible, for example. if I press a, it will send 'a' from the array list and then send test {Enter}. Then same for b, c ect. At the moment, it ignores sending the letter. Seems to overwrite them or soemthing.Think about it, if you send a while a is a hotkey it will trigegr the function again which sends the hotkey which will trigger the function again. Deactivate the hotkey before sending ; Example: HotKeySet("a") Send("a") HotKeySet("a","__1") Broken link? PM me and I'll send you the file! 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