Jump to content
Sign in to follow this  
mbm

How to make a key to activate a script. Sorry for asking this

Recommended Posts

mbm

I know I might be flamed for asking this, but I have search and looked in the Q&A.

I Have made some scripts and would like to activate them by a keystroke. Found something about Hotkeyset, but not sure how it works, and if it what I should be using?

HotKeySet("{F3}", "Go")

While 1

Sleep(100)

WEnd

Func Go()

AND HERE I SET ALL MY CODE IN

EndFunc

Am I missing something?

Edited by mbm

Share this post


Link to post
Share on other sites
bo8ster

Welcome to the forum.

It does not look like you are missing anything except to replace "AND HERE I SET ALL MY CODE IN" with some code.

When F3 is pressed, the Go function will be executed. If that is not working, let us know what it is doing wrong.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
mbm

Welcome to the forum.

It does not look like you are missing anything except to replace "AND HERE I SET ALL MY CODE IN" with some code.

When F3 is pressed, the Go function will be executed. If that is not working, let us know what it is doing wrong.

ok I got the idea wrong. I though the script would execute when the F3 key was press, but the script shold be running in the background offcouse.

Tried this which worked fine. Will try with my own script later.:

HotKeySet("{F3}", "Go")

While 1

Sleep(100)

WEnd

Func Go()

MsgBox(0, "My First Script!", "Hello World!")

EndFunc

Share this post


Link to post
Share on other sites
ajag

If you want to start running your script (or any other proramm) by pressing a key (i.e. "F3"), you can create a shortcut of your script on the desktop, go to the properties of the shortcut and enter the key you want.

A-Jay


Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Share this post


Link to post
Share on other sites
mbm

If you want to start running your script (or any other proramm) by pressing a key (i.e. "F3"), you can create a shortcut of your script on the desktop, go to the properties of the shortcut and enter the key you want.

A-Jay

Ok thanks, so no need for the Hotkey in the script then?

Share this post


Link to post
Share on other sites
ajag

Yep, this is a Windows feature to start any programm by short-key


Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Share this post


Link to post
Share on other sites
mbm

Yep, this is a Windows feature to start any programm by short-key

Thanks alot...

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  

×