Jump to content

Sleep In-Line Command Error


Recommended Posts

Is there anyway to include a Sleep command the same line as another command?

Example: I want to create a very long script that constantly inputs data into a program, but I need a delay between data sends or else program gets overflow error and script shuts down. I need something that I can just add on to the end of the line instead of having to insert over 1000 Sleep commands manually(since that'd take REALLY long amounts of time that I dont have :D ), because since all the input command end with the same thing I can do a find / replace all.

Send ("XXXXX{Enter}")

Sleep (250)

Send ("YYYYY{Enter}")

Sleep (250)

Send ("ZZZZZ{Enter}")

Sleep (250)

I want to have something like this (Using example of commands from ACTool Keys=Send / | = is quick command for sleep)

Keys (XXXXX{Enter}) | 250

Keys (YYYYY{Enter}) | 250

Keys (ZZZZZ{Enter}) | 250

If nothing exists currently, how would I go about creating a custom (user-defined) quick command to do just that? :D:wacko:

Link to comment
Share on other sites

A small User Defined Function may suit.

; Call the UDF
Keys('XXXXX{Enter}', 500)

; Use default 250 ms sleep
Keys('XXXXX{Enter}')

Func Keys($text, $time = 250)
    Send($text)
    Sleep($time)
EndFunc

:D

Amazing what a name change for a command can do. I was looking and looking for Custom Command which was what it was called. UDF huh? I'll give it a shot. Thanks
Link to comment
Share on other sites

Ok - I tried to create a UDF - and Im getting an error message about too many parameters in Call Function.

Here is a sample my code. (The game is WordWhomp on Pogo.com, It's a word jumble game, hence the large amount of data to be inputted.)

$WWTimeDelay = 75

;---------------------------------------------------------

Func WordWhomp($WWText,$WWTimeDelay)

Send ($WWText)

Sleep ($WWTimeDelay)

EndFunc

;---------------------------------------------------------

Call (WordWhomp ("abide{enter}{bs}{bs}{bs}{bs}{bs}{bs}"), )

The Call Function keeps erroring.

I've tried all the following

Call WordWhomp ("abed{enter}{bs}{bs}{bs}{bs}{bs}{bs}")

Call (WordWhomp ("abed{enter}{bs}{bs}{bs}{bs}{bs}{bs}"))

Call (WordWhomp ("abed{enter}{bs}{bs}{bs}{bs}{bs}{bs}"), 75)

Not sure what parameters I'm missing/have extra

What have I done wrong???

Link to comment
Share on other sites

HI,

try

$WWTimeDelay = 75
;---------------------------------------------------------
Func WordWhomp($WWText, $WWTimeDelay)
    Send($WWText)
    Sleep($WWTimeDelay)
EndFunc   ;==>WordWhomp
;---------------------------------------------------------
WordWhomp("abide{enter}{bs}{bs}{bs}{bs}{bs}{bs}", $WWTimeDelay)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

give this a try, set it so you could see it happen, the original went pretty fast, if you blinked you would miss it.

Run("Notepad")
WinWait("Untitled")
$WWTimeDelay = 75

WordWhomp("abide{enter}", $WWTimeDelay)
Sleep(3000)
WordWhomp("{bs}{bs}{bs}{bs}{bs}{bs}", $WWTimeDelay)

;---------------------------------------------------------
Func WordWhomp($WWText, $WWTimeDelay)
    Send($WWText)
    Sleep($WWTimeDelay)
EndFunc   ;==>WordWhomp
;---------------------------------------------------------

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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