Jump to content

Detecting processes - how?


 Share

Recommended Posts

I'm working putting together a program for us to provide to users that will back up data to a particular network drive. However, I would like to ensure that they don't have certain apps open when the backup begins.

I would like to include all of this code within one application, but thus far it seems like calling a second executable is easier for me to put together. If I'm wrong, please let me know.

Essentially, the check within the backup app runs as follows:

While 1
    Sleep(100)
    If ProcessExists('outlook.exe') Then Run('\\networkshare\public\warning.exe')

WEnd

If it exists, then it opens a small AutoIt .exe with the following code:

MsgBox(48,"Warning!","One or more applications is still running!  " & @CRLF & "" & @CRLF & "To prevent a failed backup, make sure that all other applications have been closed during this process.")

The problems here:

#1 I get an endless stream of the above message box as the process is still active. If I use this method, how can I make that "If ProcessExists" statement run just once per process detection?

#2 Isn't there a simpler way of doing this?

I don't want to kill the outlook.exe process. I do, however, want to warn the user that the program is open and that the data won't be backed up if they don't close it. So, no program shutdown is required, just a single detection.

Does anyone have a suggestion? I have searched all morning with terms like "detect process", "check process", "see if process running," etc. - thus the reason I am now posting.

Thanks for any help that can be provided!

Link to comment
Share on other sites

  • Developers

Your issue is that you use Run in stead of RunWait, but why not show a MsgBox() in stead of running another script ?

If ProcessExist("Outlook.exe") then MsgBox(0,"Backup warning"," Stupid, you need to close Outlook first.")
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Your issue is that you use Run in stead of RunWait, but why not show a MsgBox() in stead of running another script ?

If ProcessExist("Outlook.exe") then MsgBox(0,"Backup warning"," Stupid, you need to close Outlook first.")oÝ÷ Ûú®¢×«¡×¢²«}ç-jwm«pjÆjiÞuö¬¶·¬¦ì{}Èjkyȵè­#¬®éçxaz»®*mjÂ0j{^"Ë«zØZ¶+]Ù÷öØ"½ëajÖÚrK©Áªçx0éíêk¡Ç¬³¬muë^"¯z²¶º.nWË«x-«jºH~«¨¶ËZµéÛ(qË«­ç¢{"²Ö§¶¢Ú̯*.®«²Ø¨+wöÆÞq«¬x¦w±¥êâzwu8ZK¨§¶­j{0z¹ë)z·ÞrÛÇRZµïÛ&ë-²èK-«lyªÜú+¶¬Ë.z­ÚâbØ^~ën­ëaz··öƬ(!¶Ì§µ¬i®åzl"¶azX§zè¾'^u8^~éܶ*'Ãë¡Ç¬°Lb²Öìý¹è´úèqë,¬´w«{l¶¢ºÞrب«­¢+Ù%AɽÍÍá¥ÍÑÌ ÅÕ½Ðí=Õѱ½½¬¹áÅÕ½Ðì¤Ñ¡¸5Í    ½à À°ÅÕ½Ðí]ɹ¥¹ÌÌìÅÕ½Ðì°ÅÕ½Ðì5¥É½Í½Ð=Õѱ½½¬¥ÌÍÑ¥±°ÉÕ¹¹¥¹¸A±Í±½Í¥Ð½É½¹Ñ¥¹Õ¥¹¸ÅÕ½Ðì¤

Thanks again - with that edit it works like a charm!

Edited by DietCoke
Link to comment
Share on other sites

  • 5 years later...

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