Paulie Posted September 17, 2006 Share Posted September 17, 2006 (edited) I have made a code that is supposed to read an input and set hotkeys to the data in the input, it doesn't work, what do I need to have the user enter to make it be able to use hotkeys other then single letters and numbers Case $msg = $Button1 If $active = 0 then $inputhot1 = GuiCtrlRead($Input1) $inputhot2 = GuiCtrlRead($Input2) Global $Minhotkey = $Inputhot1;what do i need to do to hotkeys to make them work for modifier keys as well Global $Maxhotkey = $Inputhot2 Activate($Minhotkey,$Maxhotkey) Else MsgBox(0, "Error", "Already Active, Deactivate First") Endif also, why doesn't $TRAY_ENABLE/DISABLE get accepted as a variable, it says it's undeclared my Au3checkerror says this C:\Documents and Settings\Administrator\Local Settings\Temp\test.au3(37,43) : WARNING: $TRAY_ENABLE: possibly used before declaration. about this code $msg2 = TrayGetMsg() If $Active = 0 Then TrayItemSetState($SubMenu2, $TRAY_ENABLE) TrayItemSetState($SubMenu3, $TRAY_DISABLE) Else TrayItemSetState($SubMenu2, $TRAY_DISABLE) TrayItemSetState($SubMenu3, $TRAY_ENABLE) Endif yes i included GUIConstants.au3 too, and using latest release Why is this happening? Edited September 17, 2006 by Paulie Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 17, 2006 Moderators Share Posted September 17, 2006 $Tray_Enable is in the Constants.au3 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted September 17, 2006 Author Share Posted September 17, 2006 (edited) $Tray_Enable is in the Constants.au3Thanks missed thatwell thats one question answered, but shouldn't that be made more obvious in the online helpfileit's only in the example, and not in the syntax explanation Edited September 17, 2006 by Paulie Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 17, 2006 Moderators Share Posted September 17, 2006 (edited) Thanks missed that well thats one question answered, but shouldn't that be made more obvious in the online helpfile it's only in the example, and not in the syntax explanationI tend to look at the examples for what I may need:#Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $chkitem = TrayCreateItem("Check it") TrayCreateItem("") $checkeditem = TrayCreateItem("Checked") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $chkitem TrayItemSetState($checkeditem,$TRAY_CHECKED) Case $msg = $exititem ExitLoop EndSelect WEnd Exit Edit ... In addition to your other question, I have no idea how to test that... have an example script to play with? And what keys may be used? Edited September 17, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted September 17, 2006 Author Share Posted September 17, 2006 (edited) Edit ... In addition to your other question, I have no idea how to test that... have an example script to play with? And what keys may be used?Here is mine entire script, I made a GUI for a window minimizer, and I want people to be able to set the hotkeys however they want, but I also don't want to have to include a 'Guide' on how to properly enter the hotkey info, but i will if it is really necessary. expandcollapse popup#include <GUIConstants.au3> #include <Constants.au3> ; == GUI generated with Koda == Opt("trayMenuMode", 1) Global $active = 0 $Form1 = GUICreate("Quick Mimimize Menu", 358, 185, 321, 162, -1, $WS_EX_TOOLWINDOW) GUISetBkColor(0xD4D0C8) $Input1 = GUICtrlCreateInput("LWIN", 20, 20, 200, 21, BitOR($ES_CENTER,$ES_UPPERCASE), $WS_EX_STATICEDGE) GUICtrlCreateLabel("Minimize Hotkey", 230, 20, 113, 20) GUICtrlSetFont(-1, 10, 800, 0, "System") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xD4D0C8) $Input2 = GUICtrlCreateInput("RWIN", 20, 50, 200, 21, BitOR($ES_CENTER,$ES_UPPERCASE), $WS_EX_STATICEDGE) GUICtrlCreateLabel("Maximize Hotkey", 230, 50, 117, 20) GUICtrlSetFont(-1, 10, 800, 0, "System") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xD4D0C8) GUICtrlCreateLabel("Quick Minimizer", 0, 130, 355, 42, $SS_CENTER) GUICtrlSetFont(-1, 24, 400, 6, "Stencil") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xD4D0C8) $Button1 = GUICtrlCreateButton("Activate", 20, 88, 100, 25, $BS_FLAT) $Deactivate = GUICtrlCreateButton("Deactivate", 130, 88, 100, 25, $BS_FLAT) $Exit = GUICtrlCreateButton("Exit", 240, 88, 100, 25, $BS_FLAT) GUISetState(@SW_SHOW) $menu1 = TrayCreateMenu("Options") $SubMenu1 = TrayCreateItem("Restore", $menu1) $SubMenu2 = TrayCreateItem("Activate", $menu1) $SubMenu3 = TrayCreateItem("Deactivate", $menu1) $SubMenu4 = TrayCreateItem("Exit") While 1 $msg = GuiGetMsg() $msg2 = TrayGetMsg() If $Active = 0 Then TrayItemSetState($SubMenu2, $TRAY_ENABLE) TrayItemSetState($SubMenu3, $TRAY_DISABLE) Else TrayItemSetState($SubMenu2, $TRAY_DISABLE) TrayItemSetState($SubMenu3, $TRAY_ENABLE) Endif Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Exit Exit Case $msg2 = $SubMenu4 Exit Case $msg2 = $SubMenu2 Global $Minhotkey = "{"&GuiCtrlRead($Input1)&"}" Global $Maxhotkey = "{"&GuiCtrlRead($Input2)&"}" Activate($Minhotkey,$Maxhotkey) Case $msg2 = $SubMenu3 Deactivate() Case $msg = $Deactivate Deactivate() Case $msg = $Button1 If $active = 0 then $inputhot1 = GuiCtrlRead($Input1) $inputhot2 = GuiCtrlRead($Input2) Global $Minhotkey = "" Global $Maxhotkey = "" Activate($Minhotkey,$Maxhotkey) Else MsgBox(0, "Error", "Already Active, Deactivate First") Endif Case $msg2 = $SubMenu1 GUISetState(@Sw_SHOW, $Form1) EndSelect WEnd Exit Func Activate($f_minkey, $f_maxkey) $active = 1 GUISetState(@SW_HIDE, $Form1) HotKeySet($f_minkey, "Minimize") HotKeySet($f_maxkey, "Maximize") EndFunc Func Deactivate() $active = 0 HotKeySet($Minhotkey) HotKeySet($Maxhotkey) EndFunc Func Minimize() WinMinimizeAll() EndFunc Func Maximize() WinMinimizeAllUndo() EndFunc EDIT: almost forgot, hotkeys should be able to be any 1-2 key combonation that autoit is capable of assigning, probably gonna be ctrl+something or alt +something Edited September 17, 2006 by Paulie 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