liten Posted June 30, 2009 Share Posted June 30, 2009 ok i have a list $List4 = GUICtrlCreateList("", 139, 104, 45, 22, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetData(-1, "F1|F2|F3|F4|F5|F6|F6|F8|F9|F10|F11|F12|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T |U|V|W|X|Y|Z|") GUICtrlSetFont(-1, 8, 400, 0, "Arial") i was wondering how would i make what ever is selected(clicked) on that list is set as my hot key, here is my failire exzample: $h = GUICtrlRead($List3) HotKeySet($h, "Terminate") so if the person sselects 1, the hot key will be one, if the person selects F1, the hot key will be F1, please, i am in need of help My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] Link to comment Share on other sites More sharing options...
martin Posted June 30, 2009 Share Posted June 30, 2009 ok i have a list $List4 = GUICtrlCreateList("", 139, 104, 45, 22, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetData(-1, "F1|F2|F3|F4|F5|F6|F6|F8|F9|F10|F11|F12|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T |U|V|W|X|Y|Z|") GUICtrlSetFont(-1, 8, 400, 0, "Arial") i was wondering how would i make what ever is selected(clicked) on that list is set as my hot key, here is my failire exzample: $h = GUICtrlRead($List3) HotKeySet($h, "Terminate") so if the person sselects 1, the hot key will be one, if the person selects F1, the hot key will be F1, please, i am in need of help You need to ensure that when a key is selected form the list that the focus is removed from the list. Otherwise any key you press which is in the list and not the key you intended to select will become the newly selected key. Also, if a function key is chosen you need to enclose it in curly brackets. $gui = GUICreate("hk from list") $dummy = GUICtrlCreateEdit("",0,0,1,1);something to set focus to which is not the listbox $List4 = GUICtrlCreateList("", 139, 104, 45, 22);, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) GUICtrlSetData(-1, "F1|F2|F3|F4|F5|F6|F6|F8|F9|F10|F11|F12|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T |U|V|W|X|Y|Z|") GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUISetState() $hk = '' While 1 If GUIGetMsg() = -3 Then Exit $h = GUICtrlRead($List4) if stringleft($h,1) = "F" then $h = '{' & $h & '}' If $hk <> $h Then HotKeySet($hk);remove the last hotkey HotKeySet($h, "Terminate") $hk = $h ControlFocus($Gui,"",$dummy) EndIf WEnd Func terminate() ConsoleWrite("termin ate" & @CRLF) EndFunc ;==>terminate Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
liten Posted June 30, 2009 Author Share Posted June 30, 2009 Dosent seem to work for me, omg, hhah time to do a little google, anymore help is appriciated My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] Link to comment Share on other sites More sharing options...
martin Posted July 1, 2009 Share Posted July 1, 2009 Dosent seem to work for me, omg, hhah time to do a little google, anymore help is appriciatedWorks fine for me.You have to click on the item you want to be the hotkey, maybe you didn't try that. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
liten Posted July 1, 2009 Author Share Posted July 1, 2009 (edited) hmm i really dont understand it, could you explain some of the lines, (Not the common sense oes) ahah EDIT: is their like an easier script, or a more simpiler way to do this Edited July 1, 2009 by liten My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] Link to comment Share on other sites More sharing options...
martin Posted July 1, 2009 Share Posted July 1, 2009 (edited) hmm i really dont understand it, could you explain some of the lines, (Not the common sense oes) ahah EDIT: is their like an easier script, or a more simpiler way to do this I run it, I choose a letter or a function key from the list, click on that item and then whenever I press that key I get the "terminate" message in the bottom pane of SciTE. So the first question is "Are you using Scite?" If not the replace the function terminate with Func terminate() msgbox(262144,"you pressed","the selected hot key") EndFunc EDIT: If you can get it working then I will explain anything you need, but there is no point explaining how a script works if it doesn't. Edited July 1, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
liten Posted July 1, 2009 Author Share Posted July 1, 2009 Heres, the thing i cant seem to get it to work, and i have tried countlessly, and yes, im using SciTE, is their away to intergrate it into a case Such as While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $List or such thankyou for all the help youve been My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] Link to comment Share on other sites More sharing options...
martin Posted July 1, 2009 Share Posted July 1, 2009 Heres, the thing i cant seem to get it to work, and i have tried countlessly, and yes, im using SciTE, is their away to intergrate it into a caseSuch as While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Listor such thankyou for all the help youve beenI think you should stick with one thing and get it to work. Trying something completely different as soon as yiou have a problem is guaranteed to increase your learning time 10 fold.The script I posted works. So you need to tell me what happens when you try it. Are there any error messages? Can you see the output pane in SciTE? If you replace the function with a message box does anything happen?Start with a very simple step. You run the script, do you see the list box? if you click on the 1 in the list and then press the "1" key does anything happen? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
liten Posted July 1, 2009 Author Share Posted July 1, 2009 (edited) No erros are returned, the list apperears, but when i click anything in the list, andtry to use the hot key , it does Nothing, i think this might be a problem of placement, such as with buttons i had to use case and place them all at the top of my script to work, ? just an idea, also how can i read what is currently seledted in a list, would it be _GUICtrlListView_GetItemSelected ? EDIT:b when i place the script alone, in its own .au3, it works, but when i place it in mines it dosent? EDIT2: could you please explain first, how do i read the current selected text in a list, first, so i can understand that ??_GUICtrlListView_GetItemText($hListView, 1))?? Edited July 1, 2009 by liten My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] Link to comment Share on other sites More sharing options...
martin Posted July 2, 2009 Share Posted July 2, 2009 No erros are returned, the list apperears, but when i click anything in the list, andtry to use the hot key , it does Nothing, i think this might be a problem of placement, such as with buttons i had to use case and place them all at the top of my script to work, ? just an idea, also how can i read what is currently seledted in a list, would it be _GUICtrlListView_GetItemSelected?EDIT:b when i place the script alone, in its own .au3, it works, but when i place it in mines it dosent?EDIT2: could you please explain first, how do i read the current selected text in a list, first, so i can understand that??_GUICtrlListView_GetItemText($hListView, 1))??I think that once you discovered that the code I posted worked, (even though you originally said it doesn't), you should try to undertstand it, after all it isn't very long. Then you would have the answer to you question. Maybe you are too impatient and expect things to be obvious or otherwise someone will explain it to you. But in fact nothing is obvious untill you have spent time reading, learning and trying. No doubt that makes me sound like an old man but I can reassure you there. I'm an old man. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
liten Posted July 3, 2009 Author Share Posted July 3, 2009 Thxzs, FIXED My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u] 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