Zed Posted April 26, 2008 Share Posted April 26, 2008 (edited) Ok, I just discovered about Autoit 5 days ago and I wanna do something like this: Func _Livehotkey() Send ($oldkey[$K]) EndFunc Dim $OldKey, $NewKey, $Ctrl_OldKey, $Ctrl_NewKey Dim $K, $Knum $Ctrl_oldkey = GUICtrlCreateInput("",left,top, width, height) $oldkey = GUICtrlRead($Ctrl_oldkey) $Ctrl_newkey = GUICtrlCreateInput("",left,top, width, height) $NewKey = GUICtrlRead($Ctrl_newkey) HotKeySet($newkey, _Livehotkey) $Ctrl_SetKey = GUICtrlCreateButton("Set", left, top, width,height) $Ctrl_ResetKey = GUICtrlCreateButton("Reset", left, top, width,height) ;Under MAIN Switch $ctrl_SetKey $oldkey[$K] = GUICtrlRead($Ctrl_oldkey) $NewKey[$K] = GUICtrlRead($Ctrl_newkey) $NewKey[$K] = $Knum[$K] HotKeySet($NewKey[$K], "_Livehotkey");HMMM? $K += 1 $Ctrl_ResetKey $oldkey = 0 $NewKey = 0 $K = 0 Of course, this is just a rough draw to get the idea of what I want to do. To be clear, what I want to do is Set hotkeys so you can change/remap the keys for yourself to make stuff easier for some tasks. If it works for all alphabets and all number keys Im happy. What Im asking for is a solution to get around this so you can input initial key and new key to inputs, and then hit "Set" button to make it take effect, and "Reset" to reset all settings. Now Im blocked cauz I dont know how to achieve it. To call one specific hot ket for the one key you need, you need to set function paramater so there is a link between $K and the $oldkey stroke, which I cant. Searching for old topics was just extra tire.. It would be cool if there is any other function I can use to make it work. Thanks. Edited April 26, 2008 by Zed Link to comment Share on other sites More sharing options...
Zed Posted April 26, 2008 Author Share Posted April 26, 2008 Isnt there a quick function that can replace keyboard output to another? Link to comment Share on other sites More sharing options...
martin Posted April 26, 2008 Share Posted April 26, 2008 Ok, I just discovered about Autoit 5 days ago and I wanna do something like this: Func _Livehotkey() Send ($oldkey[$K]) EndFunc Dim $OldKey, $NewKey, $Ctrl_OldKey, $Ctrl_NewKey Dim $K, $Knum $Ctrl_oldkey = GUICtrlCreateInput("",left,top, width, height) $oldkey = GUICtrlRead($Ctrl_oldkey) $Ctrl_newkey = GUICtrlCreateInput("",left,top, width, height) $NewKey = GUICtrlRead($Ctrl_newkey) HotKeySet($newkey, _Livehotkey) $Ctrl_SetKey = GUICtrlCreateButton("Set", left, top, width,height) $Ctrl_ResetKey = GUICtrlCreateButton("Reset", left, top, width,height) ;Under MAIN Switch $ctrl_SetKey $oldkey[$K] = GUICtrlRead($Ctrl_oldkey) $NewKey[$K] = GUICtrlRead($Ctrl_newkey) $NewKey[$K] = $Knum[$K] HotKeySet($NewKey[$K], "_Livehotkey");HMMM? $K += 1 $Ctrl_ResetKey $oldkey = 0 $NewKey = 0 $K = 0 Of course, this is just a rough draw to get the idea of what I want to do. To be clear, what I want to do is Set hotkeys so you can change/remap the keys for yourself to make stuff easier for some tasks. If it works for all alphabets and all number keys Im happy. What Im asking for is a solution to get around this so you can input initial key and new key to inputs, and then hit "Set" button to make it take effect, and "Reset" to reset all settings. Now Im blocked cauz I dont know how to achieve it. To call one specific hot ket for the one key you need, you need to set function paramater so there is a link between $K and the $oldkey stroke, which I cant. Searching for old topics was just extra tire.. It would be cool if there is any other function I can use to make it work. Thanks.I don't quite see what the problem is so you might need to explain it another way. Could you have one Hot Key which gave you the option to set any hot key and an option to reset them all to some defaults? 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...
Bert Posted April 26, 2008 Share Posted April 26, 2008 This is a old script of mine, and it could easily be reworked to make it shorter by using arrays. However, it does work for what I had in mind. Enjoy! CODE#include <GuiConstants.au3> #include <ie.au3> FileInstall ("C:\Program Files\AutoIt3\Au3Info.exe", @ScriptDir&"\Au3Info.exe") Opt("TrayMenuMode",1) Opt("WinTitleMatchMode", 2) dim $ini = @ScriptDir&"/Vconfig.ini" dim $k1, $k2, $k3, $k4, $k5, $k6, $k7, $k8, $k9, $k10, $k11, $k12, $k13, $k14, $k15 dim $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12, $t13, $t14, $t15 dim $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15 $IC = FileExists($ini) if $IC = 0 then _inimake() $gui = GuiCreate("HotKey Toolbox by Volly", 950, 550,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GuiCtrlCreateLabel("1", 20, 30, 20, 20) $Label_2 = GuiCtrlCreateLabel("2", 20, 60, 20, 20) $Label_3 = GuiCtrlCreateLabel("3", 20, 90, 20, 20) $Label_4 = GuiCtrlCreateLabel("4", 20, 120, 20, 20) $Label_5 = GuiCtrlCreateLabel("5", 20, 150, 20, 20) $Label_6 = GuiCtrlCreateLabel("6", 20, 180, 20, 20) $Label_7 = GuiCtrlCreateLabel("7", 20, 210, 20, 20) $Label_8 = GuiCtrlCreateLabel("8", 20, 240, 20, 20) $Label_9 = GuiCtrlCreateLabel("9", 20, 270, 20, 20) $Label_10 = GuiCtrlCreateLabel("10", 20, 300, 20, 20) $Label_11 = GuiCtrlCreateLabel("11", 20, 330, 20, 20) $Label_12 = GuiCtrlCreateLabel("12", 20, 360, 20, 20) $Label_13 = GuiCtrlCreateLabel("13", 20, 390, 20, 20) $Label_14 = GuiCtrlCreateLabel("14", 20, 420, 20, 20) $Label_15 = GuiCtrlCreateLabel("15", 20, 450, 20, 20) $Label_16 = GuiCtrlCreateLabel("Title of window", 70, 10, 90, 20) $Label_17 = GuiCtrlCreateLabel("Text in window", 430, 10, 80, 20) $Label_18 = GuiCtrlCreateLabel("HotSetKey", 860, 10, 55, 20) $Input_19 = GuiCtrlCreateInput("", 70, 30, 340, 20);title $Input_20 = GuiCtrlCreateInput("", 430, 30, 400, 20);sub $Input_21 = GuiCtrlCreateInput("", 860, 30, 70, 20) ;hot $Input_22 = GuiCtrlCreateInput("", 70, 60, 340, 20);title $Input_23 = GuiCtrlCreateInput("", 430, 60, 400, 20);title $Input_24 = GuiCtrlCreateInput("", 860, 60, 70, 20);hot $Input_25 = GuiCtrlCreateInput("", 70, 90, 340, 20);title $Input_26 = GuiCtrlCreateInput("", 430, 90, 400, 20);sub $Input_27 = GuiCtrlCreateInput("", 860, 90, 70, 20);hot $Input_28 = GuiCtrlCreateInput("", 70, 120, 340, 20);title $Input_29 = GuiCtrlCreateInput("", 430, 120, 400, 20);sub $Input_30 = GuiCtrlCreateInput("", 860, 120, 70, 20);hot $Input_31 = GuiCtrlCreateInput("", 70, 150, 340, 20);title $Input_32 = GuiCtrlCreateInput("", 430, 150, 400, 20);sub $Input_33 = GuiCtrlCreateInput("", 860, 150, 70, 20);hot $Input_34 = GuiCtrlCreateInput("", 70, 180, 340, 20);title $Input_35 = GuiCtrlCreateInput("", 430, 180, 400, 20);sub $Input_36 = GuiCtrlCreateInput("", 860, 180, 70, 20);hot $Input_37 = GuiCtrlCreateInput("", 70, 210, 340, 20);title $Input_38 = GuiCtrlCreateInput("", 430, 210, 400, 20);sub $Input_39 = GuiCtrlCreateInput("", 860, 210, 70, 20);hot $Input_40 = GuiCtrlCreateInput("", 70, 240, 340, 20);title $Input_41 = GuiCtrlCreateInput("", 430, 240, 400, 20);sub $Input_42 = GuiCtrlCreateInput("", 860, 240, 70, 20);hot $Input_43 = GuiCtrlCreateInput("", 70, 270, 340, 20);title $Input_44 = GuiCtrlCreateInput("", 430, 270, 400, 20);sub $Input_45 = GuiCtrlCreateInput("", 860, 270, 70, 20);hot $Input_46 = GuiCtrlCreateInput("", 70, 300, 340, 20);title $Input_47 = GuiCtrlCreateInput("", 430, 300, 400, 20);sub $Input_48 = GuiCtrlCreateInput("", 860, 300, 70, 20);hot $Input_49 = GuiCtrlCreateInput("", 70, 330, 340, 20);title $Input_50 = GuiCtrlCreateInput("", 430, 330, 400, 20);sub $Input_51 = GuiCtrlCreateInput("", 860, 330, 70, 20);hot $Input_52 = GuiCtrlCreateInput("", 70, 360, 340, 20);title $Input_53 = GuiCtrlCreateInput("", 430, 360, 400, 20);sub $Input_54 = GuiCtrlCreateInput("", 860, 360, 70, 20);hot $Input_55 = GuiCtrlCreateInput("", 70, 390, 340, 20);title $Input_56 = GuiCtrlCreateInput("", 430, 390, 400, 20);sub $Input_57 = GuiCtrlCreateInput("", 860, 390, 70, 20);hot $Input_58 = GuiCtrlCreateInput("", 70, 420, 340, 20);title $Input_59 = GuiCtrlCreateInput("", 430, 420, 400, 20);sub $Input_60 = GuiCtrlCreateInput("", 860, 420, 70, 20);hot $Input_61 = GuiCtrlCreateInput("", 70, 450, 340, 20);title $Input_62 = GuiCtrlCreateInput("", 430, 450, 400, 20);sub $Input_63 = GuiCtrlCreateInput("", 860, 450, 70, 20);hot $Button_64 = GuiCtrlCreateButton("Ok", 70, 500, 90, 30) $Button_65 = GuiCtrlCreateButton("Cancel", 180, 500, 90, 30) $Button_66 = GuiCtrlCreateButton("Help", 290, 500, 90, 30) $Button_67 = GuiCtrlCreateButton("Close Program", 400, 500, 90, 30) $Button_68 = GuiCtrlCreateButton("Window ID tool", 510, 500, 90, 30) $Button_69 = GuiCtrlCreateButton("About", 860, 500, 70, 30) ;-----------------tray----------------------------------- $tray1 = TrayCreateItem("Options") $tray2 = TrayCreateItem("Help") $tray3 = TrayCreateItem("About") $tray4 = TrayCreateItem("Exit") _UDHSK() GuiSetState(@SW_HIDE) While 1 $msg = GuiGetMsg() $msg1 = TrayGetMsg() Select Case $msg1 = $tray4 or $msg = $Button_67 ExitLoop Case $msg = $GUI_EVENT_CLOSE $Qst = MsgBox(36, "Question!", "Do you wish to exit the program or hide the GUI? Click ""YES"" to exit, Click ""NO"" to hide the GUI and discard any changes") if $Qst = 6 then ExitLoop if $Qst = 7 then GuiSetState(@SW_HIDE, $gui) Case $msg1 = $tray1 GuiSetState(@SW_show,$gui) Case $msg = $Button_64 _savesettings() GuiSetState(@SW_HIDE, $gui) MsgBox(0, "Changes saved", "Your changes have been saved", 3) Case $msg = $Button_65 MsgBox(0, "Cancel", "No changes made", 5) GuiSetState(@SW_HIDE, $gui) Case $msg = $Button_68 run(@ScriptDir&"\Au3Info.exe") Case $msg = $Button_69 or $msg1 = $tray3 MsgBox(0, "About", "HotKey Toolbax by Volly"&@CRLF&"2007 Volly Productions"&@CRLF&""&@CRLF&"For more stuff, go to www.AutoItScript.com/forum", 5) Case $msg1 = $tray2 or $msg = $Button_66 MsgBox(0, "IMPORTANT", " The following 2 IE windows will explain how to set the hotsetkeys. The HotSetKey's page will"&@CRLF _ &"tell you what keys can not be made into HotSetKeys. The Send page will tell you how to enter"&@CRLF _ &"in the field any special characters so that the HotSetKey will work.") _IECreate("http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm") _IECreate("http://www.autoitscript.com/autoit3/docs/functions/Send.htm") Case Else ;;; EndSelect WEnd Exit func _inimake() $stitle = "title1=" & @LF & "title2=" & @LF & "title3="& @LF & "title4=" & @LF & "title5="& @LF & "title6=" & @LF & "title7="& @LF & "title8=" & @LF & "title9=" _ & @LF &"title10=" & @LF & "title11="& @LF & "title12=" & @LF & "title13="& @LF & "title14=" & @LF & "title15=" IniWriteSection($ini, "TITLE", $stitle) FileOpen($ini,1) FileWrite($ini, @CRLF) FileClose($ini) $stext = "text1=" & @LF & "text2=" & @LF & "text3="& @LF & "text4=" & @LF & "text5="& @LF & "text6=" & @LF & "text7="& @LF & "text8=" & @LF & "text9=" _ & @LF &"text10=" & @LF & "text11="& @LF & "text12=" & @LF & "text13="& @LF & "text14=" & @LF & "text15=" IniWriteSection($ini, "Text", $stext) FileOpen($ini,1) FileWrite($ini, @CRLF) FileClose($ini) $shsk = "key1=" & @LF & "key2=" & @LF & "key3="& @LF & "key4=" & @LF & "key5="& @LF & "key6=" & @LF & "key7="& @LF & "key8=" & @LF & "key9=" _ & @LF &"key10=" & @LF & "key11="& @LF & "key12=" & @LF & "key13="& @LF & "key14=" & @LF & "key15=" IniWriteSection($ini, "HotSetKey", $shsk) EndFunc Func HotKeyFunc() $ki = IniReadSection($ini, "HotSetKey") $ti = IniReadSection($ini, "TITLE") $xi = IniReadSection($ini, "Text") Switch @HotKeyPressed Case $ki[1][1] winactivate($ti[1][1], $xi[1][1]) Case $ki[2][1] winactivate($ti[2][1], $xi[2][1]) Case $ki[3][1] winactivate($ti[3][1], $xi[3][1]) Case $ki[4][1] winactivate($ti[4][1], $xi[4][1]) Case $ki[5][1] winactivate($ti[5][1], $xi[5][1]) Case $ki[6][1] winactivate($ti[6][1], $xi[6][1]) Case $ki[7][1] winactivate($ti[7][1], $xi[7][1]) Case $ki[8][1] winactivate($ti[8][1], $xi[8][1]) Case $ki[9][1] winactivate($ti[9][1], $xi[9][1]) Case $ki[10][1] winactivate($ti[10][1], $xi[10][1]) Case $ki[11][1] winactivate($ti[11][1], $xi[11][1]) Case $ki[12][1] winactivate($ti[12][1], $xi[12][1]) Case $ki[13][1] winactivate($ti[13][1], $xi[13][1]) Case $ki[14][1] winactivate($ti[14][1], $xi[14][1]) Case $ki[15][1] winactivate($ti[15][1], $xi[15][1]) case else HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) HotKeySet(@HotKeyPressed, "HotKeyFunc") EndSwitch EndFunc func _UDHSK() $ti = IniReadSection($ini, "TITLE") $xi = IniReadSection($ini, "Text") $ki = IniReadSection($ini, "HotSetKey") GUICtrlSetData($Input_19,$ti[1][1]) GUICtrlSetData($Input_20,$xi[1][1]) GUICtrlSetData($Input_21,$ki[1][1]) GUICtrlSetData($Input_22,$ti[2][1]) GUICtrlSetData($Input_23,$xi[2][1]) GUICtrlSetData($Input_24,$ki[2][1]) GUICtrlSetData($Input_25,$ti[3][1]) GUICtrlSetData($Input_26,$xi[3][1]) GUICtrlSetData($Input_27,$ki[3][1]) GUICtrlSetData($Input_28,$ti[4][1]) GUICtrlSetData($Input_29,$xi[4][1]) GUICtrlSetData($Input_30,$ki[4][1]) GUICtrlSetData($Input_31,$ti[5][1]) GUICtrlSetData($Input_32,$xi[5][1]) GUICtrlSetData($Input_33,$ki[5][1]) GUICtrlSetData($Input_34,$ti[6][1]) GUICtrlSetData($Input_35,$xi[6][1]) GUICtrlSetData($Input_36,$ki[6][1]) GUICtrlSetData($Input_37,$ti[7][1]) GUICtrlSetData($Input_38,$xi[7][1]) GUICtrlSetData($Input_39,$ki[7][1]) GUICtrlSetData($Input_40,$ti[8][1]) GUICtrlSetData($Input_41,$xi[8][1]) GUICtrlSetData($Input_42,$ki[8][1]) GUICtrlSetData($Input_43,$ti[9][1]) GUICtrlSetData($Input_44,$xi[9][1]) GUICtrlSetData($Input_45,$ki[9][1]) GUICtrlSetData($Input_46,$ti[10][1]) GUICtrlSetData($Input_47,$xi[10][1]) GUICtrlSetData($Input_48,$ki[10][1]) GUICtrlSetData($Input_49,$ti[11][1]) GUICtrlSetData($Input_50,$xi[11][1]) GUICtrlSetData($Input_51,$ki[11][1]) GUICtrlSetData($Input_52,$ti[12][1]) GUICtrlSetData($Input_53,$xi[12][1]) GUICtrlSetData($Input_54,$ki[12][1]) GUICtrlSetData($Input_55,$ti[13][1]) GUICtrlSetData($Input_56,$xi[13][1]) GUICtrlSetData($Input_57,$ki[13][1]) GUICtrlSetData($Input_58,$ti[14][1]) GUICtrlSetData($Input_59,$xi[14][1]) GUICtrlSetData($Input_60,$ki[14][1]) GUICtrlSetData($Input_61,$ti[15][1]) GUICtrlSetData($Input_62,$xi[15][1]) GUICtrlSetData($Input_63,$ki[15][1]) _setkeys() EndFunc func _setkeys() $ki = IniReadSection($ini, "HotSetKey") $j=1 do HotKeySet($ki[$j][1], "HotKeyFunc") $j=$j+1 Until $j= 16 EndFunc func _savesettings() $TI1 = GUICtrlRead($Input_19) $TI2 = GUICtrlRead($Input_22) $TI3 = GUICtrlRead($Input_25) $TI4 = GUICtrlRead($Input_28) $TI5 = GUICtrlRead($Input_31) $TI6 = GUICtrlRead($Input_34) $TI7 = GUICtrlRead($Input_37) $TI8 = GUICtrlRead($Input_40) $TI9 = GUICtrlRead($Input_43) $TI10 = GUICtrlRead($Input_46) $TI11 = GUICtrlRead($Input_49) $TI12 = GUICtrlRead($Input_52) $TI13 = GUICtrlRead($Input_55) $TI14 = GUICtrlRead($Input_58) $TI15 = GUICtrlRead($Input_61) $stitleU = "title1="&$TI1& @LF & "title2="&$TI2 &@LF & "title3="&$TI3 &@LF & "title4=" &$TI4& @LF & "title5="&$TI5& @LF & "title6=" &$TI6& @LF & "title7="&$TI7 &@LF & "title8=" &$TI8 &@LF & "title9=" _ &$TI9& @LF &"title10=" &$TI10 &@LF & "title11="&$TI11 &@LF & "title12=" &$TI12 &@LF & "title13="&$TI13 &@LF & "title14=" &$TI14 &@LF & "title15="&$TI15 IniWriteSection($ini, "TITLE", $stitleU) $XI1 = GUICtrlRead($Input_20) $XI2 = GUICtrlRead($Input_23) $XI3 = GUICtrlRead($Input_26) $XI4 = GUICtrlRead($Input_29) $XI5 = GUICtrlRead($Input_32) $XI6 = GUICtrlRead($Input_35) $XI7 = GUICtrlRead($Input_38) $XI8 = GUICtrlRead($Input_41) $XI9 = GUICtrlRead($Input_44) $XI10 = GUICtrlRead($Input_47) $XI11 = GUICtrlRead($Input_50) $XI12 = GUICtrlRead($Input_53) $XI13 = GUICtrlRead($Input_56) $XI14 = GUICtrlRead($Input_59) $XI15 = GUICtrlRead($Input_62) $stextU = "text1=" &$XI1 &@LF & "text2=" &$XI2 &@LF & "text3="&$XI3 &@LF & "text4=" &$XI4 &@LF & "text5="&$XI5& @LF & "text6=" &$XI6 &@LF & "text7="&$XI7 &@LF & "text8=" &$XI8& @LF & "text9=" _ &$XI9 &@LF &"text10=" &$XI10& @LF & "text11="&$XI11& @LF & "text12=" &$XI12 &@LF & "text13="&$XI13 &@LF & "text14=" &$XI14& @LF & "text15="&$XI15 IniWriteSection($ini, "Text", $stextU) $HI1 = GUICtrlRead($Input_21) $HI2 = GUICtrlRead($Input_24) $HI3 = GUICtrlRead($Input_27) $HI4 = GUICtrlRead($Input_30) $HI5 = GUICtrlRead($Input_33) $HI6 = GUICtrlRead($Input_36) $HI7 = GUICtrlRead($Input_39) $HI8 = GUICtrlRead($Input_42) $HI9 = GUICtrlRead($Input_45) $HI10 = GUICtrlRead($Input_48) $HI11 = GUICtrlRead($Input_51) $HI12 = GUICtrlRead($Input_54) $HI13 = GUICtrlRead($Input_57) $HI14 = GUICtrlRead($Input_60) $HI15 = GUICtrlRead($Input_63) $shskU = "key1=" &$HI1 &@LF & "key2=" &$HI2 &@LF & "key3="&$HI3& @LF & "key4=" &$HI4& @LF & "key5="&$HI5 &@LF & "key6=" &$HI6 &@LF & "key7="&$HI7 &@LF & "key8=" &$HI8 &@LF & "key9=" _ &$HI9 &@LF &"key10=" &$HI10 &@LF & "key11="&$HI11 &@LF & "key12=" &$HI12 &@LF & "key13="&$HI13 &@LF & "key14=" &$HI14 &@LF & "key15="&$HI15 IniWriteSection($ini, "HotSetKey", $shskU) _setkeys() EndFunc The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Zed Posted April 27, 2008 Author Share Posted April 27, 2008 (edited) Alright thanks, Im working on it =) But now i got another problem wiht reset function: Case $Ctrl_ResetKey For $K = 0 To 5 If $NewKey[$K] <> 0 Then HotKeySet ($NewKey[$K]) EndIf Next GUICtrlSetData($Ctrl_NewKey, "") $NewKey = 0 $NewKey[5] EndSwitch With this, i want to reset the hotkeys for each key that got a hotkey set, and then clear the NewKey array, but it doesnt seem to work. In, fact, nothing is working with this script.. (not even GUISetData). After I click on reset button 2 or 3 times in a row, I get an error and closes autoit. It seems a problem with array but I dont understand =( Can someone explain me pls? Edited April 27, 2008 by Zed Link to comment Share on other sites More sharing options...
martin Posted April 27, 2008 Share Posted April 27, 2008 Alright thanks, Im working on it =) But now i got another problem wiht reset function: Case $Ctrl_ResetKey For $K = 0 To 5 If $NewKey[$K] <> 0 Then HotKeySet ($NewKey[$K]) EndIf Next GUICtrlSetData($Ctrl_NewKey, "") $NewKey = 0 $NewKey[5] EndSwitch With this, i want to reset the hotkeys for each key that got a hotkey set, and then clear the NewKey array, but it doesnt seem to work. In, fact, nothing is working with this script.. (not even GUISetData). After I click on reset button 2 or 3 times in a row, I get an error and closes autoit. It seems a problem with array but I dont understand =( Can someone explain me pls?$NewKey = 0 will destroy the array butI don't think that's what you want to do. $NewKey[5] won't reset the array, you need Dim $NewKey[5]. But if you have 5 elements the your loop should be from 0 to 4. You could have included $NewKey($K) = '' in your loop then you wouldn't need Dim.. $GuiSetData?? did you mean GuiCtrlSetData? Can yu post all of yur code because I find it difficult to see what the problem is fron a small section which has varaibles which must be declared somewhere else. 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...
Zed Posted April 27, 2008 Author Share Posted April 27, 2008 (edited) Oh cool. I changed the stuff to Case $Ctrl_ResetKey ;$oldkey = 0 For $K = 0 To 5 If $NewKey[$K] <> "" Then HotKeySet ($NewKey[$K]) EndIf Next GUICtrlSetData($Ctrl_NewKey, "") $NewKey = 0 Dim $NewKey[7] and now it works. Its weird that you gota declare again the array with Dim everytime it resets though. Thanks Martin for partial info. Edited April 27, 2008 by Zed 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