Jump to content

Recommended Posts

Posted (edited)

all i need is a script that will push the left arrow key for 3 seconds then let go and then just do nothing for about 30 seconds, then push the right arrow key for 3 seconds then let go and wait for 30 seconds, and then repeat it all over can anyone help me make one please?

Edited by Faithom
  • Developers
Posted

all i need is a script that will push the left arrow key for 3 seconds then let go and then just do nothing for about 30 seconds, then push the right arrow key for 3 seconds then let go and wait for 30 seconds, and then repeat it all over can anyone help me make one please?

<{POST_SNAPBACK}>

Open the helpfile and look for these commands:

Send()

sleep()

While ... wend

Enjoy :lmao:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Send("{LEFT}")

Sleep(50000)

Send("{RIGHT}")

Sleep(50000)

ContinueLoop

is this somewhat right?

<{POST_SNAPBACK}>

Somewhat...

1 second = 1000 msec

Sleep timers are mesured in msec

So, I usually do this:

$sec = 1000
Sleep($sec*30); sleep for 30 seconds

Also you said you wanted to HOLD the left arrow for 3 seconds, right? Holding a key needs the addition of the "up/down" modifier.

{left down} Sleep {left up} Sleep {right down} sleep {right up}

I'll leave you to figure out the "While/WEnd" loop.

:lmao:

Also, look at the HotKeySet portion of the help file. That will explain how to set a hotkey to break out of the script and stop it running. o:)

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Posted

$sec = 1000

While $sec <=1000

Sleep($sec*30); sleep for 30 seconds

{left down} Sleep {left up} Sleep {right down} sleep {right up}

WEnd

that's another shot..

Posted (edited)

$sec = 1000

While $sec <=1000

Sleep($sec*30); sleep for 30 seconds

{left down} Sleep {left up} Sleep {right down} sleep {right up}

WEnd

that's another shot..

<{POST_SNAPBACK}>

I didn't give you real code. I gave you psuedo code. You have to figure out the correct syntax. It's all a learning process. No one will spoon feed you here. There is no spoon.

And FYI, While will be infinate.

Just use

While 1
; code here
WEnd

for infinate loops.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

  • Developers
Posted

While 1

Send("{LEFT}")

Sleep(50000)

Send("{RIGHT}")

Sleep(50000)

WEnd

will this just press left and right? not hold tho

<{POST_SNAPBACK}>

What about :

While 1
    Send("{LEFT DOWN}")
    Sleep(3000)
    Send("{LEFT UP}")
    Sleep(50000)
    Send("{RIGHT DOWN}")
    Sleep(3000)
    Send("{RIGHT UP}")
    Sleep(50000)
WEnd

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

While 1

Send("{LEFT}")

Sleep(50000)

Send("{RIGHT}")

Sleep(50000)

WEnd

will this just press left and right? not hold tho

<{POST_SNAPBACK}>

Correct. Every 50 seconds it will tap the left key once, followed by the right key 50 seconds later, ad infinitum.

Caveat: Your script won't care which window is active. It will send a left or right arrow to whatever window has the current focus.

Ok, I found a spoon.

$sec = 1000
$window = "Title of Window Goes Here"

HotKeySet("{ESC}", "MyExit"); set the escape key to break the script.

While 1
   Sleep(10); tiny sleep for the While loop
   WinActivate($window); activate window
   Send("{left down}"); hold left key down
   Sleep($sec * 3); 3 second delay
   Send("{left up}"); release left key
   Sleep($sec * 30); 30 second delay
   WinActivate($window); activate window
   Send("{right down}"); hold right key down
   Sleep($sec * 3); 3 second delay
   Send("{right up}"); release right key
WEnd

Func MyExit()
   Exit
EndFunc  ;==>MyExit

This script will ensure that the proper window always has focus before sending the Left or Right arrow.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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
×
×
  • Create New...