Jump to content

newbee question hotkeyset?


Recommended Posts

Hi, I have been using many hours trying to make a very simple script, but now I give up - and ask for a little help

I would like to start my script by pressing a key. Then the script should do some more keypress. But I can't get my script to start when I press the hotkey I have defined.

Here is my script.

HotKeySet("{Pause}", "test")

Func test()

Run("notepad.exe")

WinWaitActive("Unavngivet - Notesblok")

Send("This is some text.")

EndFunc

So for now I would like to press the Pause key, and then the script should start.

Thanks

Steen

Link to post
Share on other sites

The problem is that the script finishes and quits immediately.

Try this instead:

HotKeySet("{Pause}", "test")

while 1
  Sleep(100)
WEnd

Func test()
  Run("notepad.exe")
  WinWaitActive("Untitled - Notepad") 
  Send("This is some text.")
EndFunc
BlueBearrOddly enough, this is what I do for fun.
Link to post
Share on other sites
0x7FFFFFFF is basically the largest positive value that can be stored in AutoIt's numeric data type. I use hex notation because it's easier to remember than 2,147,483,647 (at least for me!).
Link to post
Share on other sites

Thank you for helping me out. This seems like a very friendly and helpsom community.

I used Bluebearr's suggestion - and eveything is fine. However, I don't quite get the logic - why should I need this:

while 1

Sleep(100)

WEnd

Thank you

Steen

Link to post
Share on other sites

Thank you for helping me out. This seems like a very friendly and helpsom community.

I used Bluebearr's suggestion - and eveything is fine. However, I don't quite get the logic - why should I need this:

while 1

Sleep(100)

WEnd

Thank you

Steen

As Bluebear said without the loop to keep your script active it just closes without waiting for any input.


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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...