Jump to content

Simple script but cant figure it out


Recommended Posts

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?

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

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:

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