Jump to content

Non-goto help


tscunard
 Share

Recommended Posts

Ihave a script that at the end it asks if you want to run the script again. I cannot figure out the correct way to do it with out the GOTO command.

Here is a short example of what I am trying to do.

1. $work=InputBox ( "WO#", "Enter Ticket Number" , "")

2. run("C:\Program Files........

3. send ("/ DAHK")

4. send ("{enter}")

5. send ($work)

6-20 do more stuff

21. $again=MsgBox ( 4, "Again", "Would you like to do another?")

If the answer is Yes, I need the script to "goto" line 1 then jump to line 5 then continue on with 6-21. But I need it to still run the "whole script" on first launch

I have read through the Forum and found some help, but I just can't seem to grasp the concept. I used to use "if then goto"......

Link to comment
Share on other sites

That seems to run lines 2-4 and not line 5, I will give it a try.

Thanks

Here is one way that lacks some error handling and such but shows how to use some flowage

$ProgramRunning = 0

Do
;1
  $work=InputBox ( "WO#", "Enter Ticket Number" , "")

;2 - 4
  If Not $ProgramRunning Then RunProg()

;5
  send ($work)
 
;6-20 do more stuff

Until MsgBox ( 4, "Again", "Would you like to do another?") <> 6

Func RunProg()
  $ProgramRunning = 1
  run("C:\Program Files........
  send ("/ DAHK")
  send ("{enter}")
EndFunc

<{POST_SNAPBACK}>

Link to comment
Share on other sites

That stuff is in my script I just left it out of my "example". here is the whole script.

I do not need the RED to run "again"

$programRunning=0

send("{NUMLOCK on}")

run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

Do

  $work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

  $user=Inputbox ("ID", "Enter Astea ID")

  $pass=Inputbox ("Password", "Enter Astea Password")

  Sleep (1500)

  WinActivate ("Persona - Microsoft Internet Explorer", "")

  WinWaitActive("Persona - Microsoft Internet Explorer", "")

  Send ("{tab 13}")

  Send("{enter}")

  Opt("WinTitleMatchMode", 4)

  WinWaitActive("classname=MSAWT_Comp_Class")

  WinWaitClose("classname=MSAWT_Comp_Class")

  WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

  sleep(1500)

  send ($user)

  send ("{enter}")

  Sleep(1500)

  send ($pass)

  send ("{enter}")

  Sleep (1500)

  If Not $ProgramRunning then RunProg()

  Sleep (1500)

  Send ("{space}")

  send("{tab}")

  send ($work)

  Send ("{NUMLOCK toggle}")

  send("{NUMLOCK on}")

  Sleep (1500)

  Opt("MouseCoordMode", 0)

 ;; Get first screen

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 234, 168, 1,2)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 235, 87, 1,2)

  Run("notepad.exe","",@SW_MAXIMIZE)

  WinActivate ("Untitled - Notepad", "")

  WinWaitActive("Untitled - Notepad", "")

  Send("^V")

  WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

  MouseClick ( "left" , 373, 322, 1,1)

 ;; Get Second screen

  send("{F12}")

  Sleep(1500)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 234, 168, 1,2)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 235, 87, 1,2)

  WinActivate ("Untitled - Notepad", "")

  WinWaitActive("Untitled - Notepad", "")

  Send("^V")

  Send("^S")

  send ($work)

  send ("{enter}")

  Sleep(1500)

  WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

  MouseClick ( "left" , 373, 322, 1,1)

  send("{F9 2}")

Until MsgBox ( 4, "Again", "Would you like to do another?") <> 6

Func RunProg()

  run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

  send ("/ DAHK")

  send ("{enter}")

EndFunc

You are lacking some fundamentals... we will start with Send()

Do not Send() until you are sure what you want to send to exists and is "active"

WinWait

WinActivate

WinWaitActive

LAr.

<{POST_SNAPBACK}>

Edited by Larry
Link to comment
Share on other sites

Ok here is the script without any changes, The RED should be skipped when it runs subsequent times. I dont need to launch the program, enter a id/password or navigate to the proper screen in the program on subsequent passes.

Thanks

send("{NUMLOCK on}")

run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

;;Loopback to here

$work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

;; Skip this part during loop

$user=Inputbox ("ID", "Enter Astea ID")

$pass=Inputbox ("Password", "Enter Astea Password")

Sleep (1500)

WinActivate ("Persona - Microsoft Internet Explorer", "")

WinWaitActive("Persona - Microsoft Internet Explorer", "")

Send ("{tab 13}")

Send("{enter}")

Opt("WinTitleMatchMode", 4)

WinWaitActive("classname=MSAWT_Comp_Class")

WinWaitClose("classname=MSAWT_Comp_Class")

WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

sleep(1500)

send ($user)

send ("{enter}")

Sleep(1500)

send ($pass)

send ("{enter}")

Sleep (1500)

send ("/ DAHK")

send ("{enter}")

;; End skip during loop

;;Jump to here during loop

Sleep (1500)

Send ("{space}")

send("{tab}")

send ($work)

Send ("{NUMLOCK toggle}")

send("{NUMLOCK on}")

Sleep (1500)

Opt("MouseCoordMode", 0)

;; Get first screen

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

Run("notepad.exe","",@SW_MAXIMIZE)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

;; Get Second screen

send("{F12}")

Sleep(1500)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

Send("^S")

send ($work)

send ("{enter}")

Sleep(1500)

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

send("{F9 2}")

;; Start loop if answer is Yes

MsgBox ( 4, "Run another Ticket?", "" )

Link to comment
Share on other sites

Ok here is the script without any changes, The RED should be skipped when it runs subsequent times. I dont need to launch the program, enter a id/password or navigate to the proper screen in the program on subsequent passes.

Thanks

send("{NUMLOCK on}")

run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

                 

                      ;;Loopback to here

$work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

               

                ;; Skip this part during loop

$user=Inputbox ("ID", "Enter Astea ID")

$pass=Inputbox ("Password", "Enter Astea Password")

Sleep (1500)

WinActivate ("Persona - Microsoft Internet Explorer", "")

WinWaitActive("Persona - Microsoft Internet Explorer", "")

Send ("{tab 13}")

Send("{enter}")

Opt("WinTitleMatchMode", 4)

WinWaitActive("classname=MSAWT_Comp_Class")

WinWaitClose("classname=MSAWT_Comp_Class")

WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

sleep(1500)

send ($user)

send ("{enter}")

Sleep(1500)

send ($pass)

send ("{enter}")

Sleep (1500)

send ("/ DAHK")

send ("{enter}")

                                  ;; End skip during loop

                ;;Jump to here during loop

Sleep (1500)

Send ("{space}")

send("{tab}")

send ($work)

Send ("{NUMLOCK toggle}")

send("{NUMLOCK on}")

Sleep (1500)

Opt("MouseCoordMode", 0)

;; Get first screen

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

Run("notepad.exe","",@SW_MAXIMIZE)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

;; Get Second screen

send("{F12}")

Sleep(1500)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

Send("^S")

send ($work)

send ("{enter}")

Sleep(1500)

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

send("{F9 2}")

      ;; Start loop if answer is Yes

MsgBox ( 4, "Run another Ticket?", "" )

<{POST_SNAPBACK}>

You can use the functions.

Do the first part of your script, the one that does not have to be repeated a Function 1 for example

Do the same with the part has to be repeated. Name it Function 2

your code will be

Function 1

Do

Function 2

Until MsgBox(4, 'Again', 'Would you like to do another?') <> 6; as sugested

That will be all the code

Link to comment
Share on other sites

That stuff is in my script I just left it out of my "example". here is the whole script.

I do not need the RED to run "again"

$programRunning=0

send("{NUMLOCK on}")

run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

Do

  $work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

  $user=Inputbox ("ID", "Enter Astea ID")

  $pass=Inputbox ("Password", "Enter Astea Password")

  Sleep (1500)

  WinActivate ("Persona - Microsoft Internet Explorer", "")

  WinWaitActive("Persona - Microsoft Internet Explorer", "")

  Send ("{tab 13}")

  Send("{enter}")

  Opt("WinTitleMatchMode", 4)

  WinWaitActive("classname=MSAWT_Comp_Class")

  WinWaitClose("classname=MSAWT_Comp_Class")

  WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

  sleep(1500)

  send ($user)

  send ("{enter}")

  Sleep(1500)

  send ($pass)

  send ("{enter}")

  Sleep (1500)

  If Not $ProgramRunning then RunProg()

  Sleep (1500)

  Send ("{space}")

  send("{tab}")

  send ($work)

  Send ("{NUMLOCK toggle}")

  send("{NUMLOCK on}")

  Sleep (1500)

  Opt("MouseCoordMode", 0)

  ;; Get first screen

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 234, 168, 1,2)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 235, 87, 1,2)

  Run("notepad.exe","",@SW_MAXIMIZE)

  WinActivate ("Untitled - Notepad", "")

  WinWaitActive("Untitled - Notepad", "")

  Send("^V")

  WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

  MouseClick ( "left" , 373, 322, 1,1)

  ;; Get Second screen

  send("{F12}")

  Sleep(1500)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 234, 168, 1,2)

  MouseClick ( "left" , 216, 47, 1,2)

  MouseClick ( "left" , 235, 87, 1,2)

  WinActivate ("Untitled - Notepad", "")

  WinWaitActive("Untitled - Notepad", "")

  Send("^V")

  Send("^S")

  send ($work)

  send ("{enter}")

  Sleep(1500)

  WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

  MouseClick ( "left" , 373, 322, 1,1)

  send("{F9 2}")

Until MsgBox ( 4, "Again", "Would you like to do another?") <> 6

Func RunProg()

  run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

  send ("/ DAHK")

  send ("{enter}")

EndFunc

<{POST_SNAPBACK}>

if red skipp you must? make red inside loop a function as Lar pointed out

Func RunProg()

$user=Inputbox ("ID", "Enter Astea ID")

$pass=Inputbox ("Password", "Enter Astea Password")

Sleep (1500)

WinActivate ("Persona - Microsoft Internet Explorer", "")

WinWaitActive("Persona - Microsoft Internet Explorer", "")

Send ("{tab 13}")

Send("{enter}")

Opt("WinTitleMatchMode", 4)

WinWaitActive("classname=MSAWT_Comp_Class")

WinWaitClose("classname=MSAWT_Comp_Class")

WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

sleep(1500)

send ($user)

send ("{enter}")

Sleep(1500)

send ($pass)

send ("{enter}")

Sleep (1500)

endfunc

Link to comment
Share on other sites

Ok that did not seem to work right, it kept asking for the user ID and password and trying to navigate to the correct part of the program, and I dont need either once the progam has been launched.

So, how bout we look at it in more simple terms....

1. Launch the program minimized

1.5 Something goes here ?????

2. Ask for the Ticket #

3. Verify that this is not the first run.

3.5 something here to jump to line 7 if not the first run ????

4. Ask for the User ID and Password

5. Activate the program and Auto input the User ID and Password

6. Navigate to the correct part of the program

7. Autoinput Ticket #

8. Copy data to notepad and save.

9. Ask if user if ther want to do another ticket.

9.5 Somthing here to jump to line 1.5 or line 2 ????

Thank you so much for all that are helping me. I have used goto for way too long!

Link to comment
Share on other sites

Okay give me a few minutes I think I have something that may be of use. I will need a couple of minutes to get it all organized and layed out properly.

Thanks for your patience,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Check out the following code for me. From everything I can tell it should suit your needs.

$ProgramRunning = "0"

Func RunProg()
   Send("{NUMLOCK on}")
   run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)
   $user=Inputbox ("ID", "Enter Astea ID")
   $pass=Inputbox ("Password", "Enter Astea Password")
   Sleep (1500)
   WinActivate ("Persona - Microsoft Internet Explorer", "")
   WinWaitActive("Persona - Microsoft Internet Explorer", "")
   Send ("{tab 13}")
   Send("{enter}")
   Opt("WinTitleMatchMode", 4)
   WinWaitActive("classname=MSAWT_Comp_Class")
   WinWaitClose("classname=MSAWT_Comp_Class")
   WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")
   sleep(1500)
   send ($user)
   send ("{enter}")
   Sleep(1500)
   send ($pass)
   send ("{enter}")
   Sleep (1500)
   $ProgramRunning = "1"
   Repeat()
EndFunc

If $ProgramRunning = "0" Then
   RunProg()
EndIf

Func Repeat()
   $work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")
   Sleep (1500)
   Send ("{space}")
   send("{tab}")
   send ($work)
   Send ("{NUMLOCK toggle}")
   send("{NUMLOCK on}")
   Sleep (1500)
   Opt("MouseCoordMode", 0)
  ;; Get first screen
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 234, 168, 1,2)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 235, 87, 1,2)
   Run("notepad.exe","",@SW_MAXIMIZE)
   WinActivate ("Untitled - Notepad", "")
   WinWaitActive("Untitled - Notepad", "")
   Send("^V") 
   WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")
   MouseClick ( "left" , 373, 322, 1,1)
  ;; Get Second screen
   send("{F12}")
   Sleep(1500)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 234, 168, 1,2)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 235, 87, 1,2)
   WinActivate ("Untitled - Notepad", "")
   WinWaitActive("Untitled - Notepad", "")
   Send("^V") 
   Send("^S") 
   send ($work)
   send ("{enter}")
   Sleep(1500)
   WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")
   MouseClick ( "left" , 373, 322, 1,1)
   send("{F9 2}")
EndFunc

If MsgBox ( 4, "Again", "Would you like to do another?") <> 6 Then 
   Repeat()
Else
   Exit
EndIf

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Well, it was missing a few lines that I had to put back in and had to add the two blue statements

The 3 green lines dont need to run on the second pass, answering yes exits and answering No runs it again, and it only runs twice. Needs to loop indefinite.

would like the ticket msgbox up front but, i can live with where it is at.

Darn close......

Func Repeat()

$work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer", "")

WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

Sleep (1500)

send ("/ DAHK")

send ("{enter}")

Sleep (1500) Send ("{space}")

send("{tab}")

send ($work)

Check out the following code for me. From everything I can tell it should suit your needs.

$ProgramRunning = "0"

Func RunProg()
   Send("{NUMLOCK on}")
   run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)
   $user=Inputbox ("ID", "Enter Astea ID")
   $pass=Inputbox ("Password", "Enter Astea Password")
   Sleep (1500)
   WinActivate ("Persona - Microsoft Internet Explorer", "")
   WinWaitActive("Persona - Microsoft Internet Explorer", "")
   Send ("{tab 13}")
   Send("{enter}")
   Opt("WinTitleMatchMode", 4)
   WinWaitActive("classname=MSAWT_Comp_Class")
   WinWaitClose("classname=MSAWT_Comp_Class")
   WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")
   sleep(1500)
   send ($user)
   send ("{enter}")
   Sleep(1500)
   send ($pass)
   send ("{enter}")
   Sleep (1500)
   $ProgramRunning = "1"
   Repeat()
EndFunc

If $ProgramRunning = "0" Then
   RunProg()
EndIf

Func Repeat()
   $work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")
   Sleep (1500)
   Send ("{space}")
   send("{tab}")
   send ($work)
   Send ("{NUMLOCK toggle}")
   send("{NUMLOCK on}")
   Sleep (1500)
   Opt("MouseCoordMode", 0)
  ;; Get first screen
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 234, 168, 1,2)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 235, 87, 1,2)
   Run("notepad.exe","",@SW_MAXIMIZE)
   WinActivate ("Untitled - Notepad", "")
   WinWaitActive("Untitled - Notepad", "")
   Send("^V") 
   WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")
   MouseClick ( "left" , 373, 322, 1,1)
  ;; Get Second screen
   send("{F12}")
   Sleep(1500)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 234, 168, 1,2)
   MouseClick ( "left" , 216, 47, 1,2)
   MouseClick ( "left" , 235, 87, 1,2)
   WinActivate ("Untitled - Notepad", "")
   WinWaitActive("Untitled - Notepad", "")
   Send("^V") 
   Send("^S") 
   send ($work)
   send ("{enter}")
   Sleep(1500)
   WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")
   MouseClick ( "left" , 373, 322, 1,1)
   send("{F9 2}")
EndFunc

If MsgBox ( 4, "Again", "Would you like to do another?") <> 6 Then 
   Repeat()
Else
   Exit
EndIf

Thanks,

JS

<{POST_SNAPBACK}>

Link to comment
Share on other sites

Glad I was able to find a solution for you... Yea I accidently deleted that stuff :-P

You shouldnt need the winwaitactive since you just activated it. So that is just an extra piece of coding though I doubt it hurts anything.

Whoo! :) Enjoy your script. Let me know if you run into any more problems.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

How Do I get it to run more twice?

It only lets me do 1 extra, then it quits.

Glad I was able to find a solution for you... Yea I accidently deleted that stuff :-P

You shouldnt need the winwaitactive since you just activated it. So that is just an extra piece of coding though I doubt it hurts anything.

Whoo! :) Enjoy your script. Let me know if you run into any more problems.

JS

<{POST_SNAPBACK}>

Link to comment
Share on other sites

Hmm... just put this in the bottom of the second function and let me know how that works out for you...

MsgBox ( 4, "Again", "Would you like to do another?")

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

That is already in my script at the bottom.

CODE

$ProgramRunning = "0"

Func RunProg()

Send("{NUMLOCK on}")

run("C:\....IEXPLORE.EXE http://xxxx/","",@SW_MINIMIZE)

$user=Inputbox ("ID", "Enter Astea ID")

$pass=Inputbox ("Password", "Enter Astea Password")

Sleep (1500)

WinActivate ("Persona - Microsoft Internet Explorer", "")

WinWaitActive("Persona - Microsoft Internet Explorer", "")

Send ("{tab 13}")

Send("{enter}")

Opt("WinTitleMatchMode", 4)

WinWaitActive("classname=MSAWT_Comp_Class")

WinWaitClose("classname=MSAWT_Comp_Class")

WinWaitActive("Dilbert (Astea) - Persona - Microsoft Internet Explorer","")

sleep(1500)

send ($user)

send ("{enter}")

Sleep(1500)

send ($pass)

send ("{enter}")

Sleep (1500)

$ProgramRunning = "1"

Repeat()

EndFunc

If $ProgramRunning = "0" Then

RunProg()

EndIf

Func Repeat()

$work=InputBox ( "WO#", "Enter ATS Ticket Number" , "WE06290598")

Sleep (1500)

Send ("{space}")

send("{tab}")

send ($work)

Send ("{NUMLOCK toggle}")

send("{NUMLOCK on}")

Sleep (1500)

Opt("MouseCoordMode", 0)

;; Get first screen

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

Run("notepad.exe","",@SW_MAXIMIZE)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

;; Get Second screen

send("{F12}")

Sleep(1500)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 234, 168, 1,2)

MouseClick ( "left" , 216, 47, 1,2)

MouseClick ( "left" , 235, 87, 1,2)

WinActivate ("Untitled - Notepad", "")

WinWaitActive("Untitled - Notepad", "")

Send("^V")

Send("^S")

send ($work)

send ("{enter}")

Sleep(1500)

WinActivate ("Dilbert (Astea) - Persona - Microsoft Internet Explorer")

MouseClick ( "left" , 373, 322, 1,1)

send("{F9 2}")

EndFunc

If MsgBox ( 4, "Again", "Would you like to do another?") <> 6 Then

Repeat()

Else

Exit

EndIf

Link to comment
Share on other sites

Thanks sugi... I was just going to have him place it at the end of the second function.

Would that work as well?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

How Do I get it to run more twice?

It only lets me do 1 extra, then it quits.

<{POST_SNAPBACK}>

Ok, from my point of view, the first part, I mean the function named RunProg() have to be runed to run the second function named repeat(), so there is meanless to use the $ProgramRunning variable. I would change not the functions but to main code to (I mean to delete all that is out of the bounds of func() and endfunc):

RunProg()

while 1

If MsgBox ( 4, "You have succesfully logged in", "Would you like to check a ticket number?") = 6 Then repeat()

else exit

endif.

wend

By the way, I think that the result of the MSGBOX has to be = 6, to run repeat(), an not different to 6. As your code is right now, just click "NO" in the msgbox to repeat the process.

Edited by jurco
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...