Sign in to follow this  
Followers 0
PcExpert

Hotkey

7 posts in this topic

Hello,

I've made a script, but it's not working. What is wrong?

HotKeySet("{PRINTSCREEN}", "MyFunction")

BlockInput(1)

Run("Notepad.exe")

WinWaitActive("Notepad")

Send("Hello, How are you? This is a test")

Func MyFunction()

BlockInput(0)

EndFunc

Thanks,

PcExpert

Share this post


Link to post
Share on other sites



WinWaitActive("Notepad") should be WinWaitActive("Untitled")

but the block input will block you from using any HotKeys.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, thanks. So that means that you cannot stop a script from being excuted?

Edited by PcExpert

Share this post


Link to post
Share on other sites

Ok, thanks. So that means that you cannot stop a script from being excuted?

You can block input but you have to remember to unblock it.

BlockInput(1)

Run("Notepad.exe")

WinWaitActive("Untitled")

Send("Hello, How are you? This is a test")

BlockInput(0)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

But I can't assign a hotkey to it? And there's no other way to do it?

Edited by PcExpert

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

But I can't assign a hotkey to it? And there's no other way to do it?

Not if your going to block the keys from use (external stopping that is). You could always use the Ctrl+Alt+Del method, and in the script if ProcessExists('tskmgr.exe') or something, then exit or unblock that way.

Edit:

Or use some type of timing method.

These are internal ideas only.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thanks for your help

PcExpert

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  
Followers 0