AutoHotkey Community

It is currently May 26th, 2012, 7:25 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Detecting running script
PostPosted: May 27th, 2008, 3:28 am 
Offline

Joined: December 29th, 2006, 6:57 am
Posts: 123
Location: Australia
I have a simple script that is initiates in the startup folder. It detects if there is a program present when a Usb memory device is inserted.

It then runs that program and exits the loop.

I wish to create another loop that keeps looking at the loaded script and if not present jumps into the first loop waiting for insertion again


Code:
Flag = 0   
   Loop{
   
      If Fileexist("e:\Myprog.exe"){
      run,e:\Myprog.exe
      Flag = 1
      }
      If Fileexist("f:\Myprog.exe"){
      run,f:\Myprog.exe
      Flag = 1
      }
      If Fileexist("g:\Myprog.exe"){
      run,g:\Myprog.exe
         Flag = 1
         }
         
      If Flag = 1
      Break
      sleep, 2000
      Continue
         }


This works fine but I need assistance to detect the running script

Terry

_________________
(The guy from Oz)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2008, 7:02 am 
use SetTimers instead of loops


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2008, 7:17 am 
Code:
Flag = 0   
   Loop{

      If Flag {
        ;look for the program
      }

      Else {

      If Fileexist("e:\Myprog.exe"){
      run,e:\Myprog.exe
      Flag = 1
      }
      If Fileexist("f:\Myprog.exe"){
      run,f:\Myprog.exe
      Flag = 1
      }
      If Fileexist("g:\Myprog.exe"){
      run,g:\Myprog.exe
         Flag = 1
         }
         
      If Flag = 1
      Break
       }
      sleep, 2000
      Continue
         }


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: bobbysoon, tomL, Yahoo [Bot] and 66 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group