Neoborn Posted March 18, 2005 Posted March 18, 2005 (edited) Hey Guys,I am working on a little project at the moment called "The Switcher" , it's a program that is going to work in conjunction with another app.What I would like to do is:1. I have input box.2. I don't want user to be able to enter text into box but the box to show what keys are being pressed.3. User presses ( I am going to give them the option of shft ctrl + key or shft ctrl alt + key) key combination that will be the hot key._ispressed? polls keyboard for any keys pressed?4. For example user presses shft ctrl + d = new hot key assigned to function 5. This hotkey combination will then launch the app change some settings first then when hit again minimize the app again.I would just like someone to give me some direction as to go about this. I would like every alphabet letter available for choice.Thanks in advance.Edit * What's the difference between ControlDisable & GUICtrlSetState? * Edited March 18, 2005 by Neoborn ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT
Neoborn Posted March 19, 2005 Author Posted March 19, 2005 So far this is what I have: expandcollapse popup;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; ; Script Name: The Switcher ; ; ; ; Script Creator: ; ; ; ; Date Created: 03/16/05 ; ; ; ; Version: 1.0 ; ; ; ; Description: Switch Modes In Yankee Clipper ; ; from History to Boilerplate. ; ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++; #include <GUIConstants.au3> #include <IsPressed.au3> Opt("GUIOnEventMode", 1) GUICreate("The Switcher", 210, 180) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState(@SW_SHOW) GUICtrlCreateLabel("The Switcher is a small program written", 10, 10) GUICtrlCreateLabel(" to switch between modes in", 35, 25) GUICtrlCreateLabel("Yankee Clipper!", 70, 40) GUICtrlCreateLabel("Hotkey", 10, 70) GUICtrlSetColor(-1,0xff0000) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=; ;The hotkey area, which shows you what key combinations you pressed GUICtrlSetFont (7, 10, 1, 0, 0 ) GUICtrlCreateGroup ("", 50, 60, 125, 30, "" , ) GUICtrlCreateLabel("Shift + Ctrl + ", 60, 71, 80, 17) GUICtrlCreateLabel("KEY", 120, 71, 20, 17) $set1 = GUICtrlCreateButton ("Set", 50, 95, 60, 20) GUICtrlSetOnEvent($set1, "SetPressed") $clr1 = GUICtrlCreateButton ("Clear", 115, 95, 60, 20) GUICtrlSetOnEvent($clr1, "ClrPressed") ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=; Func SetPressed() HotKeySet("+!$what2log", ) EndFunc Func ClrPressed() Exit EndFunc ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=; ;Keyboard poller - checks keyboard for what keys have been pressed. While 1 $sleep = 50 ;for the a If _IsPressed(41) Then _LogKeyPress("A") sleep($sleep) Elseif _IsPressed(42) Then _LogKeyPress("B") sleep($sleep) Elseif _IsPressed(43) Then _LogKeyPress("C") sleep($sleep) Elseif _IsPressed(44) Then _LogKeyPress("D") sleep($sleep) Elseif _IsPressed(45) Then _LogKeyPress("E") sleep($sleep) Elseif _IsPressed(46) Then _LogKeyPress("F") sleep($sleep) Elseif _IsPressed(47) Then _LogKeyPress("G") sleep($sleep) Elseif _IsPressed(48) Then _LogKeyPress("H") sleep($sleep) Elseif _IsPressed(49) Then _LogKeyPress("I") sleep($sleep) Elseif _IsPressed(50) Then _LogKeyPress("P") sleep($sleep) Elseif _IsPressed(51) Then _LogKeyPress("Q") sleep($sleep) Elseif _IsPressed(52) Then _LogKeyPress("R") sleep($sleep) Elseif _IsPressed(53) Then _LogKeyPress("S") sleep($sleep) Elseif _IsPressed(54) Then _LogKeyPress("T") sleep($sleep) Elseif _IsPressed(55) Then _LogKeyPress("U") sleep($sleep) Elseif _IsPressed(56) Then _LogKeyPress("V") sleep($sleep) Elseif _IsPressed(57) Then _LogKeyPress("W") sleep($sleep) Elseif _IsPressed(58) Then _LogKeyPress("X") sleep($sleep) Elseif _IsPressed(59) Then _LogKeyPress("W") sleep($sleep) Elseif _IsPressed(60) Then _LogKeyPress("0") sleep($sleep) Elseif _IsPressed(61) Then _LogKeyPress("1") sleep($sleep) Elseif _IsPressed(62) Then _LogKeyPress("2") sleep($sleep) Elseif _IsPressed(63) Then _LogKeyPress("3") sleep($sleep) Elseif _IsPressed(64) Then _LogKeyPress("4") sleep($sleep) Elseif _IsPressed(65) Then _LogKeyPress("5") sleep($sleep) Elseif _IsPressed(66) Then _LogKeyPress("6") sleep($sleep) Elseif _IsPressed(67) Then _LogKeyPress("7") sleep($sleep) Elseif _IsPressed(68) Then _LogKeyPress("8") sleep($sleep) Elseif _IsPressed(69) Then _LogKeyPress("9") sleep($sleep) Elseif _IsPressed(08) Then _LogKeyPress(" BACKSPACE ") sleep($sleep) Elseif _IsPressed(09) Then _LogKeyPress(" TAB ") Elseif _IsPressed('4A') Then _LogKeyPress("J") sleep($sleep) Elseif _IsPressed('4B') Then _LogKeyPress("K") sleep($sleep) Elseif _IsPressed('4C') Then _LogKeyPress("L") sleep($sleep) Elseif _IsPressed('4D') Then _LogKeyPress("M") sleep($sleep) Elseif _IsPressed('4F') Then _LogKeyPress("O") sleep($sleep) Elseif _IsPressed('0D') Then _LogKeyPress(" ENTER ") sleep($sleep) Elseif _IsPressed('5A') Then _LogKeyPress("Z") sleep($sleep) Elseif _IsPressed('5B') Then _LogKeyPress(" Left Windows key ") sleep($sleep) Elseif _IsPressed('5C') Then _LogKeyPress(" Right Windows key ") sleep($sleep) Elseif _IsPressed('4E') Then _LogKeyPress("N") sleep($sleep) Elseif _IsPressed(30) Then _LogKeyPress("0") sleep($sleep) Elseif _IsPressed(31) Then _LogKeyPress("1") sleep($sleep) Elseif _IsPressed(32) Then _LogKeyPress("2") sleep($sleep) Elseif _IsPressed(33) Then _LogKeyPress("3") sleep($sleep) Elseif _IsPressed(34) Then _LogKeyPress("4") sleep($sleep) Elseif _IsPressed(35) Then _LogKeyPress("5") sleep($sleep) Elseif _IsPressed(36) Then _LogKeyPress("6") sleep($sleep) Elseif _IsPressed(37) Then _LogKeyPress("7") sleep($sleep) Elseif _IsPressed(38) Then _LogKeyPress("8") sleep($sleep) Elseif _IsPressed(39) Then _LogKeyPress("9") sleep($sleep) Elseif _IsPressed(20) Then _LogKeyPress(" ") sleep($sleep) EndIf ; repeat that for every key... Sleep(50); You may need to change that value (depending on your computer“s speed) WEnd Func _LogKeyPress($what2log) ControlSetText("The Switcher", "", 9, $what2log) EndFunc ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=; ;HotKeySet("+!$what2log", ) ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=; Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;and @GUI_WINHANDLE would equal $mainwindow Exit EndFunc What I am having an issue with (am new to programming so I don't totally understand everything clearly) is capturing the value and locking it in a variable (storing it somehow) when the user presses the key. Once I have stored this value (set it with the set button(saved), I want to use this value (hot key shortcut) to launch an application from the system tray. Can anyone help me at all? ~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT
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