Dev 0 Posted March 23, 2004 Share Posted March 23, 2004 I need some help with this function: Func transformkey($key) Select Case $key = "F1" Send("{F1}") Case $key = "F2" Send("{F2}") Case $key = "F3" Send("{F3}") Case $key = "F4" Send("{F4}") Case $key = "F5" Send("{F5}") Case $key = "F6" Send("{F6}") Case $key = "F7" Send("{F7}") Case $key = "F8" Send("{F8}") EndSelect EndFunc If $mykey = F3, and i call the function like this: transformkey($mykey), it doesnt work. something wrong with the code? :postal: :iamstupid: Link to post Share on other sites
Valik 481 Posted March 23, 2004 Share Posted March 23, 2004 (edited) That can be re-written as simply:Func TransformKey($key) Send("{" & $key & "}") EndFuncAre you using a hotkey and trying to pass those key-presses on to Windows after doing your own handling? If so, you have to disable the hotkey first or you'll throw AutoIt into an infinite loop... If that is the case, then something like this would work:HotKeySet("{F1}", "OnF1Key") HotKeySet("{F2}", "OnF2Key") ; ... Func TransformKey($key) Local $k = "{" & $key & "}"; Shorthand HotKeySet($k) Send($k) HotKeySet($k, "On" & $key & "Key") EndFuncNOTE: All code untested. Edited March 23, 2004 by Valik Link to post Share on other sites
Dev 0 Posted March 23, 2004 Author Share Posted March 23, 2004 Ive got allcode exept this, the first one looks nice. thanks! :iamstupid: Link to post Share on other sites
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