ryanbogadi Posted September 8, 2005 Posted September 8, 2005 In my script, I have a function called Calendar that takes one parameter. I want to set a hotkey that calls this function with a certain number as the parameter. I tried to do it like this, but it calls it an unknown function: HotKeySet("{NUMPAD1}","Calendar(1)") Why doesn't this work?
/dev/null Posted September 8, 2005 Posted September 8, 2005 (edited) Why doesn't this work?because it's designed to work like that. From the help file section of HotKeySet: The called function can not be given parameters. They will be ignored.Solution: Define two different functions.CheersKurt Edited September 8, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
MSLx Fanboy Posted September 8, 2005 Posted September 8, 2005 @HotKeyPressed contains the key used to initiate the func Func test() MsgBox(0, "test", @HotKeyPressed) EndFunc HotKeySet("{ESC}", "test") HotKeySet("{F10}", "test") While 1 Sleep(15) Wend Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
seandisanti Posted September 8, 2005 Posted September 8, 2005 (edited) In my script, I have a function called Calendar that takes one parameter. I want to set a hotkey that calls this function with a certain number as the parameter. I tried to do it like this, but it calls it an unknown function:HotKeySet("{NUMPAD1}","Calendar(1)")Why doesn't this work?<{POST_SNAPBACK}>it doesn't work because it wasn't written to work that way. a work around could be to use the _IsPressed() UDF.#include <ispressed.au3> HotKeySet("{NUMPAD1}","Calendar") While 1 sleep(100) WEnd Func Calendar() $numpressed if _IsPressed(61) Then $numpressed = 1 if _IsPressed(62) Then $numpressed = 2 if _IsPressed(63) Then $numpressed = 3 if _IsPressed(64) Then $numpressed = 4 if _IsPressed(65) Then $numpressed = 5 if _IsPressed(66) Then $numpressed = 6 if _IsPressed(67) Then $numpressed = 7 if _IsPressed(68) Then $numpressed = 8 if _IsPressed(69) Then $numpressed = 9 ;your code here with $numpressed in place of the parameter you had EndFuncthis way your parameter will be grabbed automatically based on the number you pressed, one thing that i noticed though that maybe saunders could explain, is that it seems like only the numpad 1 registers....i tried doing a for loop, stepping forwards and backwards and still only number 1 registered or a select case, and this was my final attempt. i think the number codes may be wrong, but per the comments in _IsPressed 60 Numeric keypad 0 key 61 Numeric keypad 1 key 62 Numeric keypad 2 key 63 Numeric keypad 3 key 64 Numeric keypad 4 key 65 Numeric keypad 5 key 66 Numeric keypad 6 key 67 Numeric keypad 7 key 68 Numeric keypad 8 key 69 Numeric keypad 9 key***edit***i like MSLx Fanboy's solution better.. all you'd have to do is a select case based on @HotKeyPressed and you'd be set. Edited September 8, 2005 by cameronsdad
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