Created
August 18, 2012 23:14
-
-
Save heiths/3390293 to your computer and use it in GitHub Desktop.
ensure that only a single instance of maya is running on windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Be sure that maya's bin folder is located in your system's path. | |
Dim AllProcess, Process, strFoundProcess | |
Dim objShell : Set objShell = CreateObject("Wscript.Shell") | |
strFoundProcess = False | |
Set AllProcess = getobject("winmgmts:") 'create object | |
objShell.Run "maya.exe" | |
WScript.Sleep 4000 | |
Do | |
For Each Process In AllProcess.InstancesOf("Win32_process") 'Get all the processes running in your PC | |
If (Instr (Ucase(Process.Name),"maya.exe") = 1) then | |
objShell.Run "taskkill /IM maya.exe",1,True 'if app is running | |
strFoundProcess = True | |
End If | |
Next | |
Loop until strFoundProcess = True | |
If strFoundProcess = False Then | |
objShell.Run "maya.exe" | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment