Jump to content
Sign in to follow this  
MarcoCastro

Loops

Recommended Posts

MarcoCastro

in this script, I need to define the number of times of the sequence is repeated. That is to say, that asks to me I number (With MsgBox), and the sequence repeats the number of times.

Thank and sorry, but I need a Autoit spanish master.

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{TAB}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{TAB}{TAB}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{DOWN}{LEFT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{ALTDOWN}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{TAB}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{TAB}{TAB}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{DOWN}{LEFT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{RIGHT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{TAB}{TAB}{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{TAB}{TAB}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{DOWN}{LEFT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{ALTDOWN}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{TAB}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{TAB}{TAB}{ALTDOWN}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{DOWN}{LEFT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{ALTDOWN}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{RIGHT}{CTRLDOWN}c{CTRLUP}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{CTRLDOWN}v{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")

WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")

If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")

WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")

Send("{DOWN}{LEFT}{ESC}{ALTDOWN}{ALTUP}")

WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")

Send("{TAB}{ENTER}")

Share this post


Link to post
Share on other sites
jinxter

does this work ?

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
$val = InputBox("","Number of loops?")
$x = 1
while $x <= $val
    WinWait("Microsoft Excel - 1.xls","Worksheet Menu Bar")
    If Not WinActive("Microsoft Excel - 1.xls","Worksheet Menu Bar") Then WinActivate("Microsoft Excel - 1.xls","Worksheet Menu Bar")
    WinWaitActive("Microsoft Excel - 1.xls","Worksheet Menu Bar")
    Send("{CTRLDOWN}c{CTRLUP}{ALTDOWN}{TAB}{ALTUP}")
    WinWait("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")
    If Not WinActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard") Then WinActivate("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")
    WinWaitActive("WMSp.rsf - WRQ Reflection - IBM 5250 Terminal","Standard")
    Send("{CTRLDOWN}v{CTRLUP}{TAB}{TAB}{ALTDOWN}{TAB}{ALTUP}")
    $x=$x+1
WEnd
Send("{TAB}{ENTER}")

> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites
SadBunny

in this script, I need to define the number of times of the sequence is repeated. That is to say, that asks to me I number (With MsgBox), and the sequence repeats the number of times.

Thank and sorry, but I need a Autoit spanish master.

Well you can use a loop like For..Next, Do..Until, or While..WEnd. Either one of those can be used to keep something running indefinitely or a fixed number of times (though For..Next is best if you know the number of times before entering the loop, meaning a fixed number of times).

And you can use something like $number = InputBox(......) to let the user give you input.

The loop would look something like:

For $looper = 1 to Number($Number)  ; <-- InputBox makes the variable contain a string!
        ... do all kinds of stuff
Next

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
MarcoCastro
thanks..... you all the best......... :&#39 Edited by MarcoCastro

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  

×