Jump to content

sambassador

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by sambassador

  1. Thanks everyone - some great suggestions! @LvlUp - looks dead simple, I'll give this one a go first. @LaCastiglione - wow, that is quite a script! I think I can get some good ideas from this. @PhoenixXL - I can't believe I didn't come across that thread before! Thanks for pointing it out.
  2. Hi everyone, I'm new here and I hope this first post is OK. FWIW, I did search on the forum and on Google first to see if I could find an answer to my question, and I found a lot of great info but nothing that quite worked for me. I use a program that runs in the background on my PC all the time, and relies on the connectivity of my external USB drive (which has program data stored there). My PC has been around the block a few times and occasionally the USB connections fail on boot/wake and this causes issues with the program, because it thinks all of its data has been deleted. So I'm using AutoIt to constantly monitor for the presence of this drive, and kill the program if the drive is disconnected. Then once the drive is reconnected, the script runs the program again. After some basic testing, the script I've made (see below) seems to do the job, but the issue is that the script is constantly using 2-8% CPU, which is precious on my aging PC. I'm wondering if this is because of the DriveStatus function, and if there is a better function/method for monitoring the drive? while 1 = 1 $status = DriveStatus ("E:") If $status = "INVALID" And ProcessExists("notepad.exe") Then ProcessClose("notepad.exe") ElseIf $status = "READY" And NOT ProcessExists("notepad.exe") Then Run("notepad.exe", "") EndIf Sleep(100) WEnd Many thanks for any input!
×
×
  • Create New...