Sign in to follow this  
Followers 0
jjhols

New User Question

3 posts in this topic

I am very very new to AutoIt and scripting in general. I am wondering if anyone could help me out with a simple script (I think). Here is what I want to do. I'd like the script to check for a process running (test.exe) if test.exe is running go to the end of the script. If test.exe is not running run a script then go to the end.

Here is what I have so far if it helps.

Run, F:\\AS400\\JHAImage\\setdiip.cmd, F:\\AS400\\JHAImage\\, Hide

Sleep, 4500

Run, F:\\AS400\\AS400-SessionA.cmd, F:\\AS400\\, Hide

Thanks again from the new guy :)

Share this post


Link to post
Share on other sites



Under v2.x, isn't possible...AFAIK. (Only, maybe if you use a third-party tool)

But, you can do it with AutoIt v3.(Recommended)

Example:

$dir1= "F:\AS400\JHAImage"
$dir2= "F:\AS400"
$prcName= "test.exe"

RunWait( $dir1 & "\setdiip.cmd", '', @SW_HIDE)
RunWait( $dir2 & "\AS400-SessionA.cmd", '', @SW_HIDE)

If ProcessExists($prcName) Then
    MsgBox(0, "Notify", $prcName & " is running")
   ; your code here
Else
    MsgBox(0, "Notify", $prcName & " isn't running")
   ; your code here
EndIf

Hope it helps...

Share this post


Link to post
Share on other sites

Thank you so much this helps out a lot. I am running into one small problem we are a Citrix enviroment and this is where the .exe will run. test.exe needs to be started for every user that runs the .exe. what is happening now is if one user has test.exe running and another user launches .exe it goes to "If ProcessExists($prcName) Then

MsgBox(0, "Notify", $prcName & " is running")

; your code here"

Instead of "Else

MsgBox(0, "Notify", $prcName & " isn't running")

; your code here

EndIf"

Under v2.x, isn't possible...AFAIK. (Only, maybe if you use a third-party tool)

But, you can do it with AutoIt v3.(Recommended)

Example:

$dir1= "F:\AS400\JHAImage"
$dir2= "F:\AS400"
$prcName= "test.exe"

RunWait( $dir1 & "\setdiip.cmd", '', @SW_HIDE)
RunWait( $dir2 & "\AS400-SessionA.cmd", '', @SW_HIDE)

If ProcessExists($prcName) Then
    MsgBox(0, "Notify", $prcName & " is running")
  ; your code here
Else
    MsgBox(0, "Notify", $prcName & " isn't running")
  ; your code here
EndIf

Hope it helps...

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0