Jump to content

Send + Loop


Recommended Posts

I am having trouble with a part of my script.

Here is the section of code:

$x = 1
While $x=1

;-------------------------------------------------------------
; Find victim...
;-------------------------------------------------------------

$i = 13
Do
; First victim.
    Send("{TAB 13}")
    Send("{ENTER}")
    Sleep(10000)
    
; Attack first victim.
    Send("{TAB}")
    Sleep(250)
    Send("15")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)
    
; Refresh page.
    Send("{BROWSER_REFRESH}")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)
    
; Refresh page.
    Send("{BROWSER_REFRESH}")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)
    
; Go back to the attack page.
    Send("{BROWSER_BACK 2}")
    Sleep(500)

$a = 0
Do
;-------------------------------------------------------------
; Attack the rest of the page.
;-------------------------------------------------------------

; Next victim.
    Send("{TAB $i + 2}")
    Send("{ENTER}")
    Sleep(10000)
    
; Attack next victim.
    Send("{TAB}")
    Sleep(250)
    Send("15")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)

; Refresh page.
    Send("{BROWSER_REFRESH}")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)
    
; Refresh page.
    Send("{BROWSER_REFRESH}")
    Sleep(250)
    Send("{ENTER}")
    Sleep(5000)
    
; Go back to the attack page.
    Send("{BROWSER_BACK 2}")
    Sleep(500)

Until $a = 49

; Go to the next page and attack everyone.
    Send("{TAB 7}")
    Sleep(250)
    Send("{ENTER}")
    Sleep(10000)

    $i = $i + 2
Until $i = 63

WEnd

Line I think is faulty: Send("{TAB $i + 2}")

Line I don't think I need: $i = $i + 2

Link to comment
Share on other sites

First of all, that is wrong.

Send("{TAB " & $i + 2"}")

It would be like this:

Send("{TAB & $i + 2}")

Second of all, the way I was doing it before and the way you are trying to do it; they are both only tabbing once.

<{POST_SNAPBACK}>

had a type-o in mine left out the & sign after $i + 2

Send("{TAB " & $i + 2 & "}")

ignore the + sign it's for navigation to previous control

from help

If you with to use a variable for the count, try

    $n = 4

    Send("+{TAB " & $n & "}")

Edited by gafrost

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

So what do I do with the $i = 13 then?

<{POST_SNAPBACK}>

This is in reference to a screen function I wrote for dealing with an AS400 emulator.

The key value to look for here is $tabs. Obviously, if the first line on the screen is what I want, I don't want to tab.

If $tabs = 0 Then
   ControlSend($c, "", "PCSWS:Pres:004000001", "X{numpadenter}")
   If WaitScreen ($c, "CLINIC", 10) = 1 Then
      $screen = StringStripWS(ClipGet(), 8)
      $tmp = StringInStr($screen, "CLINIC:")
        $ppnclinic = StringRight(StringMid($screen, $tmp, 13), 6)
      If Not $ppnclinic = $clinic Then 
            MsgBox(0, "PPN/Clinic Mismatch", "Additional research required, PPN clinic does not match GELG clinic")
            MyExit()
        EndIf
   EndIf
Else
   ControlSend($c, "", "PCSWS:Pres:004000001", "{tab " & $tabs & "}X{numpadenter}")
   If WaitScreen ($c, "CLINIC", 10) = 1 Then
      $screen = StringStripWS(ClipGet(), 8)
      $tmp = StringInStr($screen, "CLINIC:")
        $ppnclinic = StringRight(StringMid($screen, $tmp, 13), 6)
      If Not $ppnclinic = $clinic Then MsgBox(0, "PPN/Clinic Mismatch", "Additional research required, PPN clinic does not match GELG clinic")
   EndIf
EndIf

If you want to do math in the code like you were specifying earlier, it may help to enclose your equation in parenthesis.

Example:

Send("{TAB " & ($i + 2) & "}")
Edited by Blue_Drache

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

Link to comment
Share on other sites

I am having trouble with a part of my script.

Here is the section of code:

$a = 0

Do

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

; Attack the rest of the page.

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

; Next victim.

    Send("{TAB $i + 2}")

    Send("{ENTER}")

    Sleep(10000)

   

; Attack next victim.

    Send("{TAB}")

    Sleep(250)

    Send("15")

    Sleep(250)

    Send("{ENTER}")

    Sleep(5000)

; Refresh page.

    Send("{BROWSER_REFRESH}")

    Sleep(250)

    Send("{ENTER}")

    Sleep(5000)

   

; Refresh page.

    Send("{BROWSER_REFRESH}")

    Sleep(250)

    Send("{ENTER}")

    Sleep(5000)

   

; Go back to the attack page.

    Send("{BROWSER_BACK 2}")

    Sleep(500)

Until $a = 49

Um...I don't see where you increment $a. You'll have an endless loop if you don't increment $a, right?
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...