Jump to content

Loops


Recommended Posts

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}")

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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