Jump to content
Sign in to follow this  
Kmanzz

Simple script but cant figure it out

Recommended Posts

Kmanzz

for the past hour i have been looking for a script example or script that would hit W for about 5 seconds then e for about 2 then d for 2 seconds then repeat over and over is there anyone who could help me out?

Share this post


Link to post
Share on other sites
narayanjr

Search for While and Send and Sleep if you mean hit W then stop for 5 seconds

Share this post


Link to post
Share on other sites
Kmanzz

i want something that hits W for 5 seconds then E for 2 then D for 2 and repeat over and over

Share this post


Link to post
Share on other sites
Achilles

i want something that hits W for 5 seconds then E for 2 then D for 2 and repeat over and over

HotKeySet('^q', '_Exit') ;Push Ctrl + q to call then function _Exit (see below)

Const $SLEEP_TIME = 30 ;The greater the value the less the keys will be pressed

While 1 ;Repeat for ever....
    $timer = TimerInit()  ;Start a timer
    Do 
        Send('W')
        Sleep($SLEEP_TIME)
    Until TimerDiff($timer) > 5000 ;Send W until five seconds are up
    Do 
        Send('E') 
        Sleep($SLEEP_TIME)
    Until TimerDiff($timer) > 7000 ;Send E until two more seconds are up
    Do 
        Send('D') 
        Sleep($SLEEP_TIME)
    Until TimerDiff($timer) > 9000 ;Send D until two more seconds are up
WEnd ;Go back to top

Func _Exit() 
    Exit ;EXITS!!!
EndFunc

Ask if you don't understand anything!

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
MisterBates

PianoMan, think your code sends W, then waits 5 secs, then sends ... and son on. What was asked was to hold down W for 5 secs - yes? Try (not tested):

$timer = TimerInit() ;Start a timer
    Do 
        Send('{W down}')
        Sleep($SLEEP_TIME)
    Until TimerDiff($timer) > 5000;Send W until five seconds are up
    send ('{W up}')
    $timer = TimerInit() ;Start a timer
    Do 
        Send('{E down}')
        Sleep($SLEEP_TIME)
    Until TimerDiff($timer) > 2000;Send E until two seconds are up
    send ('{E up}')
    ... and so on

The 'down' and 'up' were in the help for send!

Share this post


Link to post
Share on other sites
Kmanzz

Ok i have a question is there a way that i can get it to hold down W Insted of spamming W for 5 seconds

Edited by Kmanzz

Share this post


Link to post
Share on other sites
Achilles

Ok i have a question is there a way that i can get it to hold down W Insted of spamming W for 5 seconds

I'm not sure if this is doing what you want:

HotKeySet('^q', '_Exit') ;Push Ctrl + q to call then function _Exit (see below)

While 1 ;Repeat for ever....
    Send('{w down}')
    Sleep(5000)
    Send('{w up}')
    
    Send('{e down}')
    Sleep(2000)
    Send('{e up}')
    
    Send('{d down}')
    Sleep(2000)
    Send('{d up}')
WEnd ;Go back to top

Func _Exit() 
    Exit ;EXITS!!!
EndFunc

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Rauto

Hi this any good ?

Do

send("W")

sleep(5000)

send("e")

sleep(2000)

send("d")

sleep(2000)

Until ???? some condition

Share this post


Link to post
Share on other sites
Joern

I'm not sure if this is doing what you want:

HotKeySet('^q', '_Exit') ;Push Ctrl + q to call then function _Exit (see below)

While 1 ;Repeat for ever....
    Send('{w down}')
    Sleep(5000)
    Send('{w up}')
    
    Send('{e down}')
    Sleep(2000)
    Send('{e up}')
    
    Send('{d down}')
    Sleep(2000)
    Send('{d up}')
WEnd ;Go back to top

Func _Exit() 
    Exit ;EXITS!!!
EndFunc
This does not work for me. I have the same problem like some more ppl here. Something like Send('{d down}') does only send the key once. I have checked several postings here but did not find the solution. Running on XP SP2

Thx, jb

Share this post


Link to post
Share on other sites
TomCat

Hi i have also an question:

I modified this Script to:

HotKeySet('^q', '_Exit');Push Ctrl + q to call then function _Exit (see below)

While 1;Repeat for ever....
Send("{1 DOWN}")
Sleep (10)
Send("{1 UP}")
Sleep (50)
Send("{2 DOWN}")
Sleep (10)
Send("{2 UP}")
Sleep (50)
Send("{3 DOWN}")
Sleep (10)
Send("{2 UP}")
Sleep (50)
Send("{4 DOWN}")
Sleep (10)
Send("{4 UP}")
Sleep (50)
Send("{5 DOWN}")
Sleep (10)
Send("{5 UP}")
WEnd;Go back to top

Func _Exit()
    Exit;EXITS!!!
EndFunc

But i need one key to start and one key to stop or better one key to start and stop.

So if i press 1 script runs and if i press 1 again script stops.

Can someone help me to do this ? :whistle:

Share this post


Link to post
Share on other sites
TomCat

Problem solved :whistle:

Share this post


Link to post
Share on other sites
Joern

Really strange, no matter what I try something like

Send('{w down}')

Sleep(5000)

Send('{w up}')

always hits the key only 1 time. Anyone has the some problem or a solution?

jb

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  

×