Jump to content
Sign in to follow this  
Vladi243

Keyborad shortcuts

Recommended Posts

Vladi243

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.

Share this post


Link to post
Share on other sites
monoceres

HotKeySet :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Vladi243

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?

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
Kyme

Try

hotkeyset("^+s", "_IsPressed");Ctrl+Shift+S

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
Kyme

@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

Share this post


Link to post
Share on other sites
Kyme

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

Share this post


Link to post
Share on other sites
ProgAndy

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

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
Vladi243

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

Share this post


Link to post
Share on other sites
herewasplato

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

Share this post


Link to post
Share on other sites
Vladi243

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

Share this post


Link to post
Share on other sites
herewasplato

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]

Share this post


Link to post
Share on other sites
Vladi243

Maybe it's only on my computer.

Share this post


Link to post
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
Sign in to follow this  

×