Jump to content

Keyborad shortcuts


Recommended Posts

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@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 by Kyme
Link to comment
Share on other sites

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 by Kyme
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

@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]

Link to comment
Share on other sites

@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?

Link to comment
Share on other sites

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 by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...