AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detecting running script

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TeeTwo



Joined: 29 Dec 2006
Posts: 123
Location: Australia

PostPosted: Tue May 27, 2008 2:28 am    Post subject: Detecting running script Reply with quote

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)
Back to top
View user's profile Send private message
Guest






PostPosted: Tue May 27, 2008 6:02 am    Post subject: Reply with quote

use SetTimers instead of loops
Back to top
Guest






PostPosted: Tue May 27, 2008 6:17 am    Post subject: Reply with quote

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
         }
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group