Script/Bot Help?

08/07/2012 22:19 ghost710#1
Hey, I'm new to AutoIt and I need help making a bot that I can run to open a program when it closes.

More specifically I need it to:
close example2.exe if example1.exe is not running
Run example1.exe
press enter wait 10s
press enter wait 30s
run example2.exe
press tab
press up arrow
press down arrow
then if example1.exe closes repeat

Sorry if this is posted in the wrong section and thanks for any help!
08/07/2012 23:35 KDeluxe#2
While... WEnd
If... Then...
ProcessExists
Run or ShellExecute
(Control)Send
Sleep
08/08/2012 04:04 Lumi#3
Quote:
Originally Posted by KDeluxe View Post
While... WEnd
If... Then...
ProcessExists
Run or ShellExecute
(Control)Send
Sleep
PHP Code:
While 1
If Not ProcessExist("example1.exe"Then
ProcessClose
("example2.exe")
Run("example1.exe")
....
Send("{ENTER}")
Sleep(1000)
Send("{ENTER}")
Sleep(3000)
Run("example2.exe")
Send("{TAB}")
Send("{UP}")
Send("{DOWN}")
EndIf

If 
ProcessExist("example1.exe"Then
ProcessClose
("example1.exe")
EndIf

WEnd 
08/08/2012 04:24 ghost710#4
Still having trouble, launching the program to launching the second program works fine but it wont enter the Send functions after the second .exe runs and opens. Here what I got

PHP Code:
While 
If Not ProcessExists("example1.exe"Then ProcessClose ("example2.exe"
   
Run("example1.exe")
   
Sleep (12000)
   
Send ("eaxample")
   
Send ("{ENTER}")
   
Sleep (5000)
   
Send ("{ENTER}")
   
Sleep (20000)
   
Run ("example2.exe")
   
Sleep (5000)
   
Send ("{TAB}")
   
Send ("{UP}")
   
Send ("{TAB}")
   
Send ("{DOWN}")
   
Send ("{TAB}")
   
Send ("{UP}")
   
Send ("{TAB}")
   
Send ("{TAB}")
   
Send ("{ENTER}")
   
WinActivate ("example1")
Sleep (300000)
WEnd 
08/08/2012 13:11 Lumi#5
Quote:
Originally Posted by ghost710 View Post
Still having trouble, launching the program to launching the second program works fine but it wont enter the Send functions after the second .exe runs and opens. Here what I got

PHP Code:
While 
If Not ProcessExists("example1.exe"Then ProcessClose ("example2.exe"
   
Run("example1.exe")
   
Sleep (12000)
   
Send ("password")
   
Send ("{ENTER}")
   
Sleep (5000)
   
Send ("{ENTER}")
   
Sleep (20000)
   
Run ("example2.exe")
   
Sleep (5000)
   
Send ("{TAB}")
   
Send ("{UP}")
   
Send ("{TAB}")
   
Send ("{DOWN}")
   
Send ("{TAB}")
   
Send ("{UP}")
   
Send ("{TAB}")
   
Send ("{TAB}")
   
Send ("{ENTER}")
   
WinActivate ("example1")
Sleep (300000)
WEnd 
You forgot EndIf.