thomaatje Posted November 30, 2007 Share Posted November 30, 2007 (edited) I got bored and made this... expandcollapse popup#Include <Constants.au3> Opt("TrayMenuMode",1) $settingsitem = TrayCreateItem("Settings") $exititem = TrayCreateItem("Exit") $Gui = GUICreate("Hotkeys 1.0", 420, 450) $Tab1 = GUICtrlCreateTab(20, 10, 385, 385) GUICtrlSetBkColor(-1, 0xE0DFE3) $Tabitem1 = GUICtrlCreateTabitem ("Programs") $Hotkey1 = GUICtrlCreateCombo("", 150, 50, 70) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Hotkey2 = GUICtrlCreateCombo("", 150, 80) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Hotkey3 = GUICtrlCreateCombo("", 150, 110) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Hotkey4 = GUICtrlCreateCombo("", 150, 140) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Hotkey5 = GUICtrlCreateCombo("", 150, 170) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Label1 = GUICtrlCreateLabel("Hotkey 1", 50, 53) $Label2 = GUICtrlCreateLabel("Hotkey 2", 50, 83) $Label3 = GUICtrlCreateLabel("Hotkey 3", 50, 113) $Label4 = GUICtrlCreateLabel("Hotkey 4", 50, 143) $Label5 = GUICtrlCreateLabel("Hotkey 5", 50, 173) $Path1 = GUICtrlCreateInput("", 150, 230, 200) $Path2 = GUICtrlCreateInput("", 150, 260) $Path3 = GUICtrlCreateInput("", 150, 290) $Path4 = GUICtrlCreateInput("", 150, 320) $Path5 = GUICtrlCreateInput("", 150, 350) $LabelPath1 = GUICtrlCreateLabel("Filepath 1", 50, 233) $LabelPath2 = GUICtrlCreateLabel("Filepath 2", 50, 263) $LabelPath3 = GUICtrlCreateLabel("Filepath 3", 50, 293) $LabelPath4 = GUICtrlCreateLabel("Filepath 4", 50, 323) $LabelPath5 = GUICtrlCreateLabel("Filepath 5", 50, 353) $Tabitem2 = GUICtrlCreateTabitem ("Internet") $Web1 = GUICtrlCreateCombo("", 150, 50, 70) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Web2 = GUICtrlCreateCombo("", 150, 80) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Web3 = GUICtrlCreateCombo("", 150, 110) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Web4 = GUICtrlCreateCombo("", 150, 140) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Web5 = GUICtrlCreateCombo("", 150, 170) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $WebLabel1 = GUICtrlCreateLabel("Hotkey 1", 50, 53) $WebLabel2 = GUICtrlCreateLabel("Hotkey 2", 50, 83) $WebLabel3 = GUICtrlCreateLabel("Hotkey 3", 50, 113) $WebLabel4 = GUICtrlCreateLabel("Hotkey 4", 50, 143) $WebLabel5 = GUICtrlCreateLabel("Hotkey 5", 50, 173) $WebPath1 = GUICtrlCreateInput("", 150, 230, 200) $WebPath2 = GUICtrlCreateInput("", 150, 260) $WebPath3 = GUICtrlCreateInput("", 150, 290) $WebPath4 = GUICtrlCreateInput("", 150, 320) $WebPath5 = GUICtrlCreateInput("", 150, 350) $LabelWebPath1 = GUICtrlCreateLabel("Web-adress1", 50, 233) $LabelWebPath2 = GUICtrlCreateLabel("Web-adress2", 50, 263) $LabelWebPath3 = GUICtrlCreateLabel("Web-adress3", 50, 293) $LabelWebPath4 = GUICtrlCreateLabel("Web-adress4", 50, 323) $LabelWebPath5 = GUICtrlCreateLabel("Web-adress5", 50, 353) $Tabitem3 = GUICtrlCreateTabitem ("Other") $Other1 = GUICtrlCreateCombo("", 150, 50, 70) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Other2 = GUICtrlCreateCombo("", 150, 80) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Other3 = GUICtrlCreateCombo("", 150, 110) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $Other4 = GUICtrlCreateCombo("", 150, 140) GUICtrlSetData(-1,"{Home}|{END}|{ESC}|!|+|^|{F1}|{F2}|{F3}|{F4}|{F5}|{F6}|{F7}|{F8}|{F9}|{F10}|{F11}|{F12}") $OtherLabel1 = GUICtrlCreateLabel("Hotkey 1", 50, 53) $OtherLabel2 = GUICtrlCreateLabel("Hotkey 2", 50, 83) $OtherLabel3 = GUICtrlCreateLabel("Hotkey 3", 50, 113) $OtherLabel4 = GUICtrlCreateLabel("Hotkey 4", 50, 143) $OtherPath1 = GUICtrlCreateCombo("", 150, 230, 200) GUICtrlSetData(-1,"Shutdown|Reboot|Standby|CMD") $OtherPath2 = GUICtrlCreateCombo("", 150, 260) GUICtrlSetData(-1,"Shutdown|Reboot|Standby|CMD") $OtherPath3 = GUICtrlCreateCombo("", 150, 290) GUICtrlSetData(-1,"Shutdown|Reboot|Standby|CMD") $OtherPath4 = GUICtrlCreateCombo("", 150, 320) GUICtrlSetData(-1,"Shutdown|Reboot|Standby|CMD") $LabelOtherPath1 = GUICtrlCreateLabel("Other Action1", 50, 233) $LabelOtherPath2 = GUICtrlCreateLabel("Other Action2", 50, 263) $LabelOtherPath3 = GUICtrlCreateLabel("Other Action3", 50, 293) $LabelOtherPath4 = GUICtrlCreateLabel("Other Action4", 50, 323) GUICtrlCreateTabitem ("") ; end tabitem definition $InfoGroup = GUICtrlCreateGroup("Info", 230, 45, 150, 170) GUICtrlSetBkColor(-1, 0xFCFCFE) $InfoLabel1 = GUICtrlCreateLabel("For ctrl+C type: ^C", 255, 65) GUICtrlSetBkColor(-1, 0xFCFCFE) $InfoLabel2 = GUICtrlCreateLabel("For Shift+C type: +C", 255, 95) GUICtrlSetBkColor(-1, 0xFCFCFE) $InfoLabel3 = GUICtrlCreateLabel("For alt+C type: !C", 255, 125) GUICtrlSetBkColor(-1, 0xFCFCFE) $InfoLabel4 = GUICtrlCreateLabel("Type the path of the" & @CRLF & "file of hotkey 1 in" & @CRLF & "FilePath 1", 255, 160) GUICtrlSetBkColor(-1, 0xFCFCFE) $Ok = GUICtrlCreateButton("Ok", 30, 400, 100, 25) $Save = GUICtrlCreateButton("Save", 150, 400, 100, 25) $Open = GUICtrlCreateButton("Open", 270, 400, 100, 25) GUISetState() While 1 $msg = GUIGetMsg() $traymsg = TrayGetMsg() Select Case $msg = -3 GUISetState(@SW_HIDE) Case $msg = $Ok HotKeySet(GUICtrlRead($Web1), "Web1") HotKeySet(GUICtrlRead($Web2), "Web2") HotKeySet(GUICtrlRead($Web3), "Web3") HotKeySet(GUICtrlRead($Web4), "Web4") HotKeySet(GUICtrlRead($Web5), "Web5") HotKeySet(GUICtrlRead($Hotkey1), "Hotkey1") HotKeySet(GUICtrlRead($Hotkey2), "Hotkey2") HotKeySet(GUICtrlRead($Hotkey3), "Hotkey3") HotKeySet(GUICtrlRead($Hotkey4), "Hotkey4") HotKeySet(GUICtrlRead($Hotkey5), "Hotkey5") HotKeySet(GUICtrlRead($Other1), "Other1") HotKeySet(GUICtrlRead($Other2), "Other2") HotKeySet(GUICtrlRead($Other3), "Other3") HotKeySet(GUICtrlRead($Other4), "Other4") HotKeySet(GUICtrlRead($Other5), "Other5") GUISetState(@SW_HIDE) TrayTip("Hotkey 1.0", "Hotkeys set...", 5) Case $msg = $Save $filesave = FileSaveDialog("Save File", @MyDocumentsDir, "Hotkey file (*.hot)|Ini file (*.ini)|All files (*.*)") IniWrite($filesave, "Hotkey", "Hotkey1", GUICtrlRead($Hotkey1)) IniWrite($filesave, "Hotkey", "Hotkey2", GUICtrlRead($Hotkey2)) IniWrite($filesave, "Hotkey", "Hotkey3", GUICtrlRead($Hotkey3)) IniWrite($filesave, "Hotkey", "Hotkey4", GUICtrlRead($Hotkey4)) IniWrite($filesave, "Hotkey", "Hotkey5", GUICtrlRead($Hotkey5)) IniWrite($filesave, "Hotkey", "Path1", GUICtrlRead($Path1)) IniWrite($filesave, "Hotkey", "Path2", GUICtrlRead($Path2)) IniWrite($filesave, "Hotkey", "Path3", GUICtrlRead($Path3)) IniWrite($filesave, "Hotkey", "Path4", GUICtrlRead($Path4)) IniWrite($filesave, "Hotkey", "Path5", GUICtrlRead($Path5)) IniWrite($filesave, "Hotkey", "WebHotkey1", GUICtrlRead($Web1)) IniWrite($filesave, "Hotkey", "WebHotkey2", GUICtrlRead($Web2)) IniWrite($filesave, "Hotkey", "WebHotkey3", GUICtrlRead($Web3)) IniWrite($filesave, "Hotkey", "WebHotkey4", GUICtrlRead($Web4)) IniWrite($filesave, "Hotkey", "WebHotkey5", GUICtrlRead($Web5)) IniWrite($filesave, "Hotkey", "WebPath1", GUICtrlRead($WebPath1)) IniWrite($filesave, "Hotkey", "WebPath2", GUICtrlRead($WebPath2)) IniWrite($filesave, "Hotkey", "WebPath3", GUICtrlRead($WebPath3)) IniWrite($filesave, "Hotkey", "WebPath4", GUICtrlRead($WebPath4)) IniWrite($filesave, "Hotkey", "WebPath5", GUICtrlRead($WebPath5)) IniWrite($filesave, "Hotkey", "OtherHotkey1", GUICtrlRead($Other1)) IniWrite($filesave, "Hotkey", "OtherHotkey2", GUICtrlRead($Other2)) IniWrite($filesave, "Hotkey", "OtherHotkey3", GUICtrlRead($Other3)) IniWrite($filesave, "Hotkey", "OtherHotkey4", GUICtrlRead($Other4)) IniWrite($filesave, "Hotkey", "OtherPath1", GUICtrlRead($OtherPath1)) IniWrite($filesave, "Hotkey", "OtherPath2", GUICtrlRead($OtherPath2)) IniWrite($filesave, "Hotkey", "OtherPath3", GUICtrlRead($OtherPath3)) IniWrite($filesave, "Hotkey", "OtherPath4", GUICtrlRead($OtherPath4)) TrayTip("Hotkey 1.0", "Saved hotkey file to: " & $filesave, 5) Case $msg = $Open $fileopen = FileOpenDialog("Save File", @MyDocumentsDir, "Hotkey file (*.hot)|Ini file (*.ini)|All files (*.*)") $open1 = IniRead($fileopen, "Hotkey", "Hotkey1", "Not Found") $open2 = IniRead($fileopen, "Hotkey", "Hotkey2", "Not Found") $open3 = IniRead($fileopen, "Hotkey", "Hotkey3", "Not Found") $open4 = IniRead($fileopen, "Hotkey", "Hotkey4", "Not Found") $open5 = IniRead($fileopen, "Hotkey", "Hotkey5", "Not Found") $open6 = IniRead($fileopen, "Hotkey", "Path1", "Not Found") $open7 = IniRead($fileopen, "Hotkey", "Path2", "Not Found") $open8 = IniRead($fileopen, "Hotkey", "Path3", "Not Found") $open9 = IniRead($fileopen, "Hotkey", "Path4", "Not Found") $open10 = IniRead($fileopen, "Hotkey", "Path5", "Not Found") GUICtrlSetData($Hotkey1, $open1) GUICtrlSetData($Hotkey2, $open2) GUICtrlSetData($Hotkey3, $open3) GUICtrlSetData($Hotkey4, $open4) GUICtrlSetData($Hotkey5, $open5) GUICtrlSetData($Path1, $open6) GUICtrlSetData($Path2, $open7) GUICtrlSetData($Path3, $open8) GUICtrlSetData($Path4, $open9) GUICtrlSetData($Path5, $open10) $open11 = IniRead($fileopen, "Hotkey", "WebHotkey1", "Not Found") $open12 = IniRead($fileopen, "Hotkey", "WebHotkey2", "Not Found") $open13 = IniRead($fileopen, "Hotkey", "WebHotkey3", "Not Found") $open14 = IniRead($fileopen, "Hotkey", "WebHotkey4", "Not Found") $open15 = IniRead($fileopen, "Hotkey", "WebHotkey5", "Not Found") $open16 = IniRead($fileopen, "Hotkey", "WebPath1", "Not Found") $open17 = IniRead($fileopen, "Hotkey", "WebPath2", "Not Found") $open18 = IniRead($fileopen, "Hotkey", "WebPath3", "Not Found") $open19 = IniRead($fileopen, "Hotkey", "WebPath4", "Not Found") $open20 = IniRead($fileopen, "Hotkey", "WebPath5", "Not Found") GUICtrlSetData($Web1, $open11) GUICtrlSetData($Web2, $open12) GUICtrlSetData($Web3, $open13) GUICtrlSetData($Web4, $open14) GUICtrlSetData($Web5, $open15) GUICtrlSetData($WebPath1, $open16) GUICtrlSetData($WebPath2, $open17) GUICtrlSetData($WebPath3, $open18) GUICtrlSetData($WebPath4, $open19) GUICtrlSetData($WebPath5, $open20) $open21 = IniRead($fileopen, "Hotkey", "OtherHotkey1", "Not Found") $open22 = IniRead($fileopen, "Hotkey", "OtherHotkey2", "Not Found") $open23 = IniRead($fileopen, "Hotkey", "OtherHotkey3", "Not Found") $open24 = IniRead($fileopen, "Hotkey", "OtherHotkey4", "Not Found") $open26 = IniRead($fileopen, "Hotkey", "OtherPath1", "Not Found") $open27 = IniRead($fileopen, "Hotkey", "OtherPath2", "Not Found") $open28 = IniRead($fileopen, "Hotkey", "OtherPath3", "Not Found") $open29 = IniRead($fileopen, "Hotkey", "OtherPath4", "Not Found") GUICtrlSetData($Other1, $open21) GUICtrlSetData($Other2, $open22) GUICtrlSetData($Other3, $open23) GUICtrlSetData($Other4, $open24) GUICtrlSetData($OtherPath1, $open26) GUICtrlSetData($OtherPath2, $open27) GUICtrlSetData($OtherPath3, $open28) GUICtrlSetData($OtherPath4, $open29) TrayTip("Hotkey 1.0", "Opened hotkey file from: " & $fileopen, 5) Case $traymsg = $exititem ExitLoop Case $traymsg = $settingsitem GUISetState(@SW_SHOW) EndSelect WEnd Func Hotkey1() Run(GUICtrlRead($Path1)) EndFunc Func Hotkey2() Run(GUICtrlRead($Path2)) EndFunc Func Hotkey3() Run(GUICtrlRead($Path3)) EndFunc Func Hotkey4() Run(GUICtrlRead($Path4)) EndFunc Func Hotkey5() Run(GUICtrlRead($Path5)) EndFunc Func Web1() $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 .Width=600 .Silent=1 $IEWnd=HWnd(.hWnd) EndWith $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = GUICtrlRead($WebPath1) $oIE.Navigate( $URL ) EndFunc Func Web2() $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 .Width=600 .Silent=1 $IEWnd=HWnd(.hWnd) $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = GUICtrlRead($WebPath2) $oIE.Navigate( $URL ) EndFunc Func Web3() $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 .Width=600 .Silent=1 $IEWnd=HWnd(.hWnd EndWith $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = GUICtrlRead($WebPath3) $oIE.Navigate( $URL ) EndFunc Func Web4() $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 .Width=600 .Silent=1 $IEWnd=HWnd(.hWnd) EndWith $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = GUICtrlRead($WebPath4) $oIE.Navigate( $URL ) EndFunc Func Web5() $oIE=ObjCreate("InternetExplorer.Application.1") With $oIE .Visible=1 .Top = (@DesktopHeight-400)/2 .Height=400 .Width=600 .Silent=1 $IEWnd=HWnd(.hWnd) EndWith $EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents") if @error then Msgbox(0,"AutoIt COM Test", _ "ObjEvent: Can't use event interface 'DWebBrowserEvents'. Error code: " & hex(@error,8)) exit endif $URL = GUICtrlRead($WebPath5) $oIE.Navigate( $URL ) EndFunc Func Other1() $OtherPath1read = GUICtrlRead($OtherPath1) If $OtherPath1read = "Shutdown" Then Shutdown(1) ElseIf $OtherPath1read = "Reboot" Then Shutdown(6) ElseIf $OtherPath1read = "Standby" Then Shutdown(32) ElseIf $OtherPath1read = "CMD" Then Run("CMD.exe") EndIf EndFunc Func Other2() $OtherPath2read = GUICtrlRead($OtherPath2) If $OtherPath2read = "Shutdown" Then Shutdown(3) ElseIf $OtherPath2read = "Reboot" Then Shutdown(6) ElseIf $OtherPath2read = "Standby" Then Shutdown(34) ElseIf $OtherPath2read = "CMD" Then Run("CMD.exe") EndIf EndFunc Func Other3() $OtherPath3read = GUICtrlRead($OtherPath3) If $OtherPath3read = "Shutdown" Then Shutdown(1) ElseIf $OtherPath3read = "Reboot" Then Shutdown(6) ElseIf $OtherPath3read = "Standby" Then Shutdown(32) ElseIf $OtherPath3read = "CMD" Then Run("CMD.exe") EndIf EndFunc Func Other4() $OtherPath4read = GUICtrlRead($OtherPath4) If $OtherPath4read = "Shutdown" Then Shutdown(1) ElseIf $OtherPath4read = "Reboot" Then Shutdown(6) ElseIf $OtherPath4read = "Standby" Then Shutdown(32) ElseIf $OtherPath4read = "CMD" Then Run("CMD.exe") EndIf EndFunc Func Other5() $OtherPath5read = GUICtrlRead($OtherPath5) If $OtherPath5read = "Shutdown" Then Shutdown(1) ElseIf $OtherPath5read = "Reboot" Then Shutdown(6) ElseIf $OtherPath5read = "Standby" Then Shutdown(32) ElseIf $OtherPath5read = "CMD" Then Run("CMD.exe") EndIf EndFunc Hope you like it Update4: Now hotkeys for reboot, shutdown and standby too. Edited December 1, 2007 by Forsaken Link to comment Share on other sites More sharing options...
AlmarM Posted November 30, 2007 Share Posted November 30, 2007 The settings... Make the hotkey a combo with all hotkeys in it. Like: {HOME} {ESC} etc. Some people doest know the { } or the + for SHIFT. And if you start the program the settings sould pop up. And if you want to change the hotkey or path THEN you can choose the settings option Nice idea btw ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
thomaatje Posted November 30, 2007 Author Share Posted November 30, 2007 Updated Link to comment Share on other sites More sharing options...
thomaatje Posted November 30, 2007 Author Share Posted November 30, 2007 Any1? 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