PowerShape and PowerMill API Forum
Welcome to Autodesk’s PowerShape and PowerMill API Forums. Share your knowledge, ask questions, and explore popular API topics.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add a judgment in scrpt of Autodesk manufacturing post processor ,Determine whether PowerInpsct is running 。

Message 1 of 2
230 Views, 1 Reply

How to add a judgment in scrpt of Autodesk manufacturing post processor ,Determine whether PowerInpsct is running 。

Dear All :


CS.cut is a inspect program , it was creat in PowerMill not PowerInpsect , Use S.pmoptz to debug CS.cut , it was ok 。


How to add a judgment in scrpt of S.pmoptz ,Determine whether PowerInpsct is running 。 If Powerinspect is open, the output is normal. If PoewrInspect is not open, an error message is displayed to open PowerInpect .


Please help me to write such a judgment, thanks!


Thanks and Best Regards


Message 2 of 2
in reply to: yongjunhan

after doing some searches on internet : it seems to be impossible to do this with javascript, as javascript does not have access to system level processes.

But with VBScript it would be possible. Couldn't test it though.

I found this example :


' Function to check if a process is running

Function IsProcessRunning(processName)

    Dim objWMIService, colProcesses, objProcess


    ' Get the WMI service object

    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")


    ' Query for processes with the specified name

    Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & processName & "'")


    ' Check if the process is running

    For Each objProcess In colProcesses

        IsProcessRunning = True

        Exit Function



    ' Process not found

    IsProcessRunning = False

End Function


' Example usage

Dim processName, result

processName = "notepad.exe" ' Replace with the name of the process you want to check

result = IsProcessRunning(processName)


If result Then

    WScript.Echo processName & " is running."


    WScript.Echo processName & " is not running."

End If


I don't know if this will work with the post. Have fun !

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums