Jump to content

odd behavior with ProcessExists


Recommended Posts

I created a script to monitor a process and run a bat file if the process didn't exist.  Here's the text:

While 1
    If ProcessExists("ewRfidLinkSvc.exe") = 0 Then Run("C:\startRFID.bat")
    Sleep (10000)
WEnd

The script worked great for a few days and then stopped working.

On a whim, I rewrote the script in this fashion:

While 1
    $i = ProcessExists("ewRfidLinkSvc.exe")
    If $i = 0 Then Run("C:\startRFID.bat")
    Sleep (10000)
WEnd

This script is working as I text.

My question is, why did reading the ProcessExists return value directly and then executing my Run command work, then fail, and is it better to set the return value to a variable as a general rule?

Thanks for any responses.

_aleph_

Meds.  They're not just for breakfast anymore. :'(

Link to comment
Share on other sites

  • Moderators


The script worked great for a few days and then stopped working.

 

You have to be able to figure out that is not enough information. No mention of what (if any) errors you received, no idea of the environment you're running in, the AutoIt version, nothing?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Sorry, JLogan1o13 if I didn't give enough info.  Scripts written with AutoIt v.3.3.10.2, running compiled on an XP kiosk.  When it fails, the Autoit script process is running in task manager, and if I double-click the .bat file it runs.  Apparently the older version of the Autoit script has stopped running the .bat file.  I get no error, just no action.  Even restarting the XP box didn't help - if I stopped the service, the process was eliminated, but the script didn't run the .bat file.  I'm very perplexed.  What could go wrong in such a simple script that had worked when I rolled it out?

Thanks for responding.

_aleph_

Meds.  They're not just for breakfast anymore. :'(

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...