Jump to content
Sign in to follow this  
moltra

help with program

Recommended Posts

moltra

I am trying to write an Autoit script that will monitor for a window from a certain program to pop up and activate a control in it and restart the program again.

my script seems to shutdown randomly, and at times it will work properly and others it will not.

Can some one look at the code below and tell me what I am doing wrong.

i=0

While $i <20000000

WinWait("program")

ControlClick("Program popup", "", 2)

sleep (15000)

Run("C:\Program Files\program.exe")

$i=$i+1

WEnd

Share this post


Link to post
Share on other sites
moltra

Will that allow the autoit script to keep running and restart the program.exe when it stops? I am trying to keep this program running 24/7

Share this post


Link to post
Share on other sites
November

Will that allow the autoit script to keep running and restart the program.exe when it stops? I am trying to keep this program running 24/7

Yeap.

The code will go on and on and on...

The problem is your computer... can he manage? :)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
moltra

Small addition/correction:

While 1
  WinWait("program popup")
  WinActivate("program popup")
  ControlClick("program popup", "", 2)
    
  ; wait for process close
  While ProcessExists("program.exe")
    Sleep(100)
  WEnd
    
  Run("C:\Program Files\program.exe")
WEnd
I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal?

Share this post


Link to post
Share on other sites
PaulIA

I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal?

It's just making sure the "program popup" is the active window. You can take it out. I'm just the paranoid type. :)

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites
Zedna

I changed the program using the above code, but the system tray icon keeps flashing a RED X. Is that normal?

If you click on tray icon script pauses. You can unpause it.

You can avoid this behaviour by:

Opt('TrayAutoPause',0)

Share this post


Link to post
Share on other sites
moltra

I noticed that if I have this script running and the popup pops up it will not do anything, but if I have the popup active and I start this script it gets rid of the popup, but does not restart the program.

Share this post


Link to post
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
Sign in to follow this  

×