Vladi243 Posted June 13, 2008 Posted June 13, 2008 I want to create keyboard shortcuts. After searching in the forum and in the help file, I found the functiom _IsPressed() for this purpose. I don't understand how to use it. Can you explain me how should I use it? For example to pop a MsgBox when I press on ctrl+shift+s.
monoceres Posted June 13, 2008 Posted June 13, 2008 HotKeySet Broken link? PM me and I'll send you the file!
Vladi243 Posted June 13, 2008 Author Posted June 13, 2008 I have already tried the function HotKeySet, But I can put in this func only one hotkey. I want to make ctrl+shift+s. Can you give me an example?
monoceres Posted June 13, 2008 Posted June 13, 2008 I have already tried the function HotKeySet, But I can put in this func only one hotkey. I want to make ctrl+shift+s.Can you give me an example?Read the send section in the helpfile. It has the exact same syntax as hotkeyset. Broken link? PM me and I'll send you the file!
monoceres Posted June 13, 2008 Posted June 13, 2008 Try hotkeyset("^+s", "_IsPressed");Ctrl+Shift+S Not very smart. _IsPressed is already defined in Misc.au3 so if you define it in your script and also include misc.au3 you will get errors. Broken link? PM me and I'll send you the file!
Kyme Posted June 13, 2008 Posted June 13, 2008 (edited) @monoceres i understand he wanna use the hotkey for that function:D some example: #include <GuiConstants.au3> GUICreate("Form1",150,150) GUISetState(false) hotkeyset("^s", "msg");Ctrl+S While 1 WEnd Func msg() MsgBox(0,"MSG","You press Ctrl-S") EndFunc Edited June 13, 2008 by Kyme
Vladi243 Posted June 13, 2008 Author Posted June 13, 2008 It's not working. I tried it for example HotKeySet ("+!s", "PopMsg");Alt+Shift+S While 1 Sleep (100) WEnd Func PopMsg() MsgBox (4096, "Test", "Success") EndFunc As I read in the hekpfile, it must work.
Kyme Posted June 13, 2008 Posted June 13, 2008 (edited) It's not working. I tried it for example HotKeySet ("+!s", "PopMsg");Alt+Shift+S While 1 Sleep (100) WEnd Func PopMsg() MsgBox (4096, "Test", "Success") EndFunc As I read in the hekpfile, it must work.add to youre script in first line this #include <GuiConstants.au3> will look like this #include <GuiConstants.au3> HotKeySet ("+!s", "PopMsg");Alt+Shift+S While 1 Sleep (100) WEnd Func PopMsg() MsgBox (4096, "Test", "Success") EndFunc Edited June 13, 2008 by Kyme
ProgAndy Posted June 13, 2008 Posted June 13, 2008 And this works for me. I get the MsgBox, as it is supposed to be, but you coul dtry: HotKeySet ("+S", "PopMsg");Alt+Shift+S (A big S includes the Shift-Key, too ) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
monoceres Posted June 13, 2008 Posted June 13, 2008 add to youre script in first line this #include <GuiConstants.au3> Also not very smart, GUIConstants is just a bunch of constants so that won't do any good. @Vladi243 Your script should work. It did for me Broken link? PM me and I'll send you the file!
Vladi243 Posted June 13, 2008 Author Posted June 13, 2008 (edited) uuuhhhh... Now I found the problem. I should use capital "S". Here is the working script HotKeySet ("+!S", "PopMsg");Alt+Shift+S While 1 Sleep (100) WEnd Func PopMsg() MsgBox (4096, "Test", "Success") EndFunc Thanks everybody. Edited June 13, 2008 by Vladi243
herewasplato Posted June 13, 2008 Posted June 13, 2008 @Vladi243, Try this code...HotKeySet("+!s", "PopMsg");Alt+Shift+S For $i = 5 To 1 Step -1 TrayTip($i, "Sleeping", 5) Sleep(1000) Next TrayTip("", "MsgBox should be there", 50) Send("+!s") Func PopMsg() MsgBox(4096, "Test", "Success") EndFunc ;==>PopMsg...and let us know the results. [size="1"][font="Arial"].[u].[/u][/font][/size]
Vladi243 Posted June 13, 2008 Author Posted June 13, 2008 @Vladi243, Try this code...HotKeySet("+!s", "PopMsg");Alt+Shift+S For $i = 5 To 1 Step -1 TrayTip($i, "Sleeping", 5) Sleep(1000) Next TrayTip("", "MsgBox should be there", 50) Send("+!s") Func PopMsg() MsgBox(4096, "Test", "Success") EndFunc ;==>PopMsg...and let us know the results.It's working only if change the small "s" to capital "S" as I said in the previous massege. Is it a bug?
herewasplato Posted June 13, 2008 Posted June 13, 2008 (edited) uuuhhhh... Now I found the problem.I should use capital "S".Glad that is is working, but it should not matter for that particular combination of modifiers. Try the code that I posted and change the "s" in the Send line to upper or lower case. Also try changing the "s" in the HotKeySet line to either case. They need not agree... one can be upper case and the other lower case... and it should still work.Edit: Hmmm, not sure why it matters for your computer? Edited June 14, 2008 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
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