marko001 Posted June 28, 2012 Share Posted June 28, 2012 (edited) Hi all,back again to AutoIt after a while...I have a minimal problem I need to solve.I'm building a tool that will run an application with just an "hotkeyset".But, since there is another application (geolocalization of water infrastructures) running that uses customizable shortcuts, I want to let user choose a personal key.So, brutally this is the idea (and it works perfectly)expandcollapse popup#include <GUIConstantsEx.au3> #include <HotKeyInput.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") Global $Form, $HKI1, $HKI2, $Button, $Text Global $app = "Thermo" HotKeySet("^y", "_kill") $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HKI1 = _GUICtrlHKI_Create(0, 56, 55, 230, 20) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows _KeyLock(0x062E) GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $Button = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState() $out = 0 While $out = 0 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button $out = 1 $KB = StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI1)), 4) GUISetState(@SW_HIDE) EndSwitch WEnd While 1 If _IsPressed($KB, $dll) Then _launchAPP() WEnd DllClose($dll) Func _launchAPP() MsgBox(0,"Test OK","Test OK") _kill() ; just run the application EndFunc Func _kill() Exit 0 EndFunc ;==>_killBUT this only works for regular keys, not combo (i.e. ALT-F6)Is there a way to let _ispressed() to understand combo ?Obviously all is about 2 lines:$KB = StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI1)), 4)and_IsPressed($KB, $dll)if I use ,4 I get all the parameters but it seems _ispressed read only the last two digitsThanks,Marco Edited June 28, 2012 by marko001 Link to comment Share on other sites More sharing options...
Airwolf Posted June 28, 2012 Share Posted June 28, 2012 Just use two conditions. While 1 If _IsPressed("A2",$hDLL) AND _IsPressed("41",$hDLL) Then ; Do Stuff EndIf WEnd Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
marko001 Posted June 28, 2012 Author Share Posted June 28, 2012 This works if I always use 2 keys. i.e. ALT+F6 But condition returns 0 if I set as keybind just F6 Isn't it? 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