Jump to content

Help for a script


Recommended Posts

Hi all,

This is my first message here.

I'd like to create a script like this:

-The script wait for me to press SPACE

-The script wait for 12 seconds (for example)

-The script press SPACE hisself.

Is it possible to create such a script and if yes, which functions do I need to use ?

Regards, :whistle:

Link to comment
Share on other sites

I haven't tested this, but it will probably work:

HotKeySet(" ", "SendSpace")

Sleep(12000)
SendSpace()

Func SendSpace()
    Send(" ")
    Exit
EndFunc

I think there's an _IsPressed UDF also that might work better in a For loop.

Link to comment
Share on other sites

If you want the keypress delayed 12 seconds then use this.

HotKeySet("{SPACE}", "GoSpaceBar")

While 1
    Sleep(50)
WEnd

Func GoSpaceBar()
    Sleep(12000)
    HotKeySet("{SPACE}")
    Send(" ")
    HotKeySet("{SPACE}", "GoSpaceBar")
EndFunc

If you want it to send a space when you press space, and another space after 12 seconds, then use this.

HotKeySet("{SPACE}", "GoSpaceBar")

While 1
    Sleep(50)
WEnd

Func GoSpaceBar()
    HotKeySet("{SPACE}")
    Send(" ")
    Sleep(12000)
    Send(" ")
    HotKeySet("{SPACE}", "GoSpaceBar")
EndFunc
Link to comment
Share on other sites

I got this message:

Posted Image

<{POST_SNAPBACK}>

you were not removing your hotkey binding prior to sending the hotkey... so each send was calling the function to send another, but your function was never ending. So your function was just instanciating itself over and over until it died...
Link to comment
Share on other sites

Delay all characters?

You mean like...

...
HotKeySet(" ")
BlockInput(1)
Sleep(12000)
Send(" ")
BlockInput(0)
HotKeySet(" ", "GoSpaceBar")
...

This will block all mouse and keyboard input and make it seem like Windows has locked up for 12 seconds, then send a space.

If you mean you want to capture all keyboard input and delay it on a per keystroke basis, you'd have to HotKeySet all the keys on the keyboard and I'm pretty sure they have limited the number of hotkeys to disallow this functionality as it lead to people creating keyloggers. I think AutoHotKey will do it though.

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...