tamir Posted December 31, 2004 Share Posted December 31, 2004 (edited) i have 2 questions about HotKeySet: 1) if i want it to do a function like func($var_a, $var_, how i aim the HotKeySet to it? i can only type the function's name 2) is it possible to do hotkey for t AND s? coz if i type HotKeySet("ts", "") it will work for pressing "s" Edited December 31, 2004 by tamir Link to comment Share on other sites More sharing options...
Einzeinbleth Posted December 31, 2004 Share Posted December 31, 2004 (edited) Func Func_Name ($var_a, $var_ ;code goes here EndFunc IT IS IN HELP FILE ! TRY start-programs-AutoIt v3-AutoIt help file you will found almost everything INSTANTLY Edited December 31, 2004 by Einzeinbleth Link to comment Share on other sites More sharing options...
tamir Posted December 31, 2004 Author Share Posted December 31, 2004 1) i know how to make a function.... i asked how do i call to a function with variables with HotKeySet. 2) i looked in the help file but couldn't find something... Link to comment Share on other sites More sharing options...
Einzeinbleth Posted December 31, 2004 Share Posted December 31, 2004 (edited) oh, sorry mi mistake hmzzzzz i tryed and my code doesnt work i cant help HotKeySet("a", "FuncName('test title', 'test text')") func FuncName($value_a, $value_b) msgbox(0, $value_a, $value_b) endfunc while (1) sleep(100) wend i think that in part: HotKeySet("a", "FuncName('test title', 'test text')"), the 'test title' and 'test text' will always be constant, so try to use something like HotKeySet("a", "FuncName") func FuncName() $value_a='test title' $value_b='test text' msgbox(0, $value_a, $value_b) endfunc while (1) sleep(100) wend Edited December 31, 2004 by Einzeinbleth Link to comment Share on other sites More sharing options...
themax90 Posted December 31, 2004 Share Posted December 31, 2004 Try HotKeySet("t" & "s", FUNC) or HotKeySet("t", FUNC) HotKeySet("s", FUNC) Func Func() ;Code here EndFunc Link to comment Share on other sites More sharing options...
tamir Posted December 31, 2004 Author Share Posted December 31, 2004 ehh.... as i already said, i know how to make a function, but when i have this function: Func func($var) MsgBox(0, "", $var) EndFunc and i want to make a hotkey for it, i need to specifiy the $var, but i cant write HotKeySet("s", "func(text)") coz i need to write only the name of the func. so what can i do? Link to comment Share on other sites More sharing options...
Einzeinbleth Posted December 31, 2004 Share Posted December 31, 2004 Chceck my modified post Link to comment Share on other sites More sharing options...
themax90 Posted December 31, 2004 Share Posted December 31, 2004 I TOLD YOU. HOTKEYSET("t" & "s", FUNC) READ IT PLEASE. Link to comment Share on other sites More sharing options...
Einzeinbleth Posted December 31, 2004 Share Posted December 31, 2004 I TOLD YOU.HOTKEYSET("t" & "s", FUNC)READ IT PLEASE.<{POST_SNAPBACK}>He was talking about something likeHotKeySet("key", "funcname($var)") Try to use normal variables them should work normally. Or maybe post rest of your code, so peoples can help in another way... ? Link to comment Share on other sites More sharing options...
tamir Posted December 31, 2004 Author Share Posted December 31, 2004 ???? ok, say i have a function like this: Func func($var) MsgBox(0, "", $var) EndFunc if i write func("text") it will display a msgbox with the word "text". now, i want to make these hotkeys: ctrl+a - write "abc" = func("abc") ctrl+b - write "def" = func("def") so how i do it with HotKeySet? Link to comment Share on other sites More sharing options...
Valik Posted January 1, 2005 Share Posted January 1, 2005 If "t" & "s" == "ts" Then MsgBox(4096,"","DOH!")Lar.<{POST_SNAPBACK}>Dumbass would of been my message choice, Larry, but to each their own, I guess. Link to comment Share on other sites More sharing options...
Insolence Posted January 1, 2005 Share Posted January 1, 2005 Tamir you can't use parameters in a HotKeySet function callback. You can ONLY use the function, sorry. It works that way for a lot of things, you just have to be clever and figure a way around it, I suppose. "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
tamir Posted January 1, 2005 Author Share Posted January 1, 2005 I TOLD YOU.HOTKEYSET("t" & "s", FUNC)READ IT PLEASE.<{POST_SNAPBACK}>it aint working....if i press "s" FUNC is activate Link to comment Share on other sites More sharing options...
therks Posted January 1, 2005 Share Posted January 1, 2005 (edited) Wow. So much misinformation in this thread, it's almost mind boggling. Not until post #13 did any real information make it's way through. Er, wait, post #5 does have one thing going for it. If you want to have a function work on two different keys (ie 't' and 's') then do two seperate calls to HotKeySet, as post #5 suggested. HotKeySet("t", "FuncName") HotKeySet("s", "FuncName") If people actually tried their methods before posting them, it would go a long way towards not confusing people. *Edit: Just thought of something. If you're looking to do a hotkey for pressing T and S at the same time, I don't believe it can be done. I'm pretty sure you can only combine the modifier keys (Alt, Shift, Ctrl, Windows). Just thought I'd mention that in case it was what you were really looking for. Edited January 1, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
tamir Posted January 1, 2005 Author Share Posted January 1, 2005 *Edit: Just thought of something. If you're looking to do a hotkey for pressing T and S at the same time, I don't believe it can be done. I'm pretty sure you can only combine the modifier keys (Alt, Shift, Ctrl, Windows).Just thought I'd mention that in case it was what you were really looking for.<{POST_SNAPBACK}>it was what i was looking for... Link to comment Share on other sites More sharing options...
therks Posted January 1, 2005 Share Posted January 1, 2005 Ah I see. I'm sorry I couldn't be of more help. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
tamir Posted January 1, 2005 Author Share Posted January 1, 2005 it works, thanks! now, is there a function that get the classname of window? Link to comment Share on other sites More sharing options...
themax90 Posted January 1, 2005 Share Posted January 1, 2005 PLEASE check the HELPFILE before you post man......WinGetClassList --------------------------------------------------------------------------------Retrieves the classes from a window.WinGetClassList ( "title" [, "text"] )Parameterstitle The title of the window to read. text [optional] The text of the window to read. Return ValueSuccess: Returns a string containing the window classes read. Failure: Returns numeric 1 and sets @error to 1 if no window matches the criteria.RemarksClass names are linefeed (@LF) separated. WinGetClassList works on both minimized and hidden windows. Up to 64KB of text can be retrieved. If multiple windows match the criteria, the classes are read from the most recently active window.RelatedWinGetText, ControlCommand Example$text = WinGetClassList("Untitled -", "")MsgBox(0, "Text read was:", $text) WinGetHandle --------------------------------------------------------------------------------Retrieves the internal handle of a window.WinGetHandle ( "title" [, "text"] )Parameterstitle The title of the window to read. text [optional] The text of the window to read. Return ValueSuccess: Returns a string containing the window handle value. Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria. RemarksThis function is for use with the advanced WinTitleMatchMode options that allow you to use classnames and handles to specify windows rather than "title" and "text".Once you have obtained the handle you can access the required window even if its title changes.RelatedWinTitleMatchMode (Option) Example; Identify the Notepad window that contains the text "this one" and get a handle to it; Change into the WinTitleMatchMode that supports classnames and handlesAutoItSetOption("WinTitleMatchMode", 4); Get the handle of a notepad window that contains "this one"$handle = WinGetHandle("classname=Notepad", "this one")If @error Then  MsgBox(4096, "Error", "Could not find the correct window")Else  ; Send some text directly to this window's edit control  ControlSend($handle, "", "Edit1", "AbCdE")EndIfMost questions can be answered by searching in the helpfile for just classname of classnameid or whatever. Please do so first. No offense.....AutoIt Smith Link to comment Share on other sites More sharing options...
tamir Posted January 1, 2005 Author Share Posted January 1, 2005 i swear i always look in the help file before i post. i wrote in search "classname" and it didn't find this function, so don't get mad on me plz... and thanks for the reply . Link to comment Share on other sites More sharing options...
themax90 Posted January 1, 2005 Share Posted January 1, 2005 npjust look harder next time please. 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