Jump to content

Help needed finishing my first script


Recommended Posts

Hi I have been trying to work out how to loop this script for a while now but I jsut can't fathom it any help would be really appriciated.

; Get screen details
WinActivate("Ses a")
MouseClickDrag("Left",47,119,103,124) 
sleep(200)
Send("!e")
sleep(100)
Send("c")
sleep(100)
$screenno = ClipGet()

If $screenno = "10" Then
    MouseClick("left", 530, 601)
    sleep(500)
Else
    Send("{F2}")
    MouseClickDrag("Left",47,119,103,124)
    sleep(200)
    Send("!e")
    sleep(100)
    Send("c")
    sleep(100)
    $screenno1 = ClipGet()
If $screenno1 = "10" Then
    MouseClick("left", 530, 601)
    sleep(500)
Else
    MsgBox(0,"Error","Go to the first window. Accessed normally via the F2 Key")
EndIF
EndIF

; Get email address
$cemail =InputBox("Enter email address","Enter email address")

MouseClick("left", 530, 601)
sleep(500)
Send("223")
sleep(500)
Send("{NUMPADENTER}")
sleep(500)
Send($cemail)
Send("{NUMPADENTER}")
sleep(500)

; Get details
MouseClickDrag("Left",47,407,300,411) 
sleep(300)
Send("!e")
sleep(300)
Send("c")
sleep(500)
Send("{F2}")
sleep(500)
$details = ClipGet()
$details1 = StringStripWS($details, 8)
$code = StringLeft($details1, 6)
$num1 = StringMid($details1, 7, 8)
$type = StringRight($details1, 2)
$num2 = StringLeft($details1, 16)

If $details1 = "" Then Exit;this will need to be changed to ask the user if they wish to start again if yes then start again else quit

; enter record
Send("241")
Sleep(500)
Send("{NUMPADENTER}")
Sleep(500)
Send("{END}")
Sleep(500)
Send("{TAB}")
Sleep(500)
Send("{END}")
Sleep(500)
Send($details1)
Sleep(500)
MouseClick("Left",617,507)
Send("N")
Sleep(500)
Send("{NUMPADENTER}")

; Get screen details
MouseClickDrag("Left",47,119,103,124)
sleep(200)
Send("!e")
sleep(100)
Send("c")
sleep(100)
$screenno2 = ClipGet()

If $screenno2 = "63" Then
    Send("{F6}")
    sleep(500)
Else
    Send("1")
    Sleep(500) 
    Send("{NUMPADENTER}")
    Sleep(500) 
    Send("{F6}")
    sleep(500)
EndIF

; Add comment

Send("{F6}")
Sleep(300)
Send("{TAB}")
Sleep(300)
Send("please update your email") 
Send("{NUMPADENTER}")
Sleep(300)
Send("{F2}")
Sleep(1000)

I want to loop the whole thing based on a message box and want to present the option to start again if details1 ="" proberly using a msgbox

Link to comment
Share on other sites

Func Everything()
    ;your script here...insert the following at apporpriate point:
    $value = MsgBox(4, "Start Again?", "Do you wish to start again?")
    If $value = 6 Then
        Sleep(10)
    Else
        Exit
    EndIf
    ;the rest of your script
EndFunc


While 1
    Everything()
WEnd

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...