Sign in to follow this  
Followers 0
scooper

How to know if a script is it's working

5 posts in this topic

hi all,

I try to make a script that control if another autoit script it's working, and if not it'll run it.

I tried with ProcessExists but it doesn't work because the script is .au3 and not .exe, I suppose!

Thanks for any suggestions

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thank you Info for your answer,

so there is no way to control(like the function _singleton), with another script, if an .au3 is already working?

Edited by scooper

Share this post


Link to post
Share on other sites

Have the first script create a dummy text file while it's running, and also have it delete it before exitting. Have the second script check (FileExists) if or not the file exists..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

hi all,

I try to make a script that control if another autoit script it's working, and if not it'll run it.

I tried with ProcessExists but it doesn't work because the script is .au3 and not .exe, I suppose!

Thanks for any suggestions

http://www.autoitscript.com/forum/index.php?showtopic=61122&st=0&p=459147&hl=Win32_ProcessStartup&fromsearch=1&#entry459147

example("AutoIt3.exe")
Func example($ProcessName)
Dim $SW_NORMAL = 1
$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & $strComputer & "\root\cimv2")

$objStartup = $objWMIService.Get("Win32_ProcessStartup")
$objProcess = $objWMIService.Get("Win32_Process")
    $colProcessStopTrace = $objWMIService.ExecNotificationQuery _
        ("SELECT * FROM Win32_ProcessStartTrace")
        $message =  "Waiting for process " & $ProcessName & " to Start ..."
        SplashTextOn("Process", $message, 400, 70, 0, 0, 4, "")
        sleep(3000)
       SplashOff ( )
       $list = ProcessList($ProcessName)
       $TXT = ""
       For $i = 1 To $list[0][0]
        $TXT &= $list[$i][1] & @CR
       Next
       $i = 0
    Do
        $objLatestEvent = $colProcessStopTrace.NextEvent
        If Not StringInStr($TXT, $objLatestEvent.ProcessId) Then
            $message = "StartProcess Name: " _
                & $objLatestEvent.ProcessName
           SplashTextOn("Process", $message, 400, 70, 0, 0, 4, "")
           sleep(4000)
            $message = "Process ID: " & $objLatestEvent.ProcessId
           SplashTextOn("Process", $message, 400, 70, 0, 0, 4, "")
           sleep(4000)
            SplashOff ( )
        $i = 1
    EndIf
Until $i = 1
exit
EndFunc

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0