Proces ID of calling App 
Author Message
 Proces ID of calling App

Does anyone know if it is possible for a script to know the process ID of
the calling application?

Thanks,
John Hucker MCSE.



Sun, 08 Aug 2004 23:31:36 GMT  
 Proces ID of calling App
AFAIK - no. If you _call_ an application from a script using WshExec,
you can get a PID that way, then save it to a file which a script
later called by the app itself would check.  Here's an example (drawn
from the docs) on using PIDs.  I am usually in the situation of having
one script call another; in that case, if I need to have a script know
its own PID, I actually pass the path of the pidfile to the script
being called as an argument.

Sub delayedSendKeys(str)
     WScript.Sleep 100
     WshShell.SendKeys str
End Sub

Dim WshShell, oCalc, oNotepad
Set WshShell = CreateObject("WScript.Shell")
Set oCalc = WshShell.Exec("calc")
Set oNotepad = WshShell.Exec("notepad")
WScript.Sleep 500

WshShell.AppActivate oCalc.ProcessID
delayedSendKeys "1{+}1~"
delayedSendKeys "^C"
delayedSendKeys "%{F4}"

WshShell.AppActivate oNotepad.ProcessID
delayedSendKeys "1 {+} 1 = ^V"


Quote:
> Does anyone know if it is possible for a script to know the process
ID of
> the calling application?

> Thanks,
> John Hucker MCSE.



Mon, 09 Aug 2004 07:38:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. is proces ready, not started ?

2. Helpdesk / Call Tracking ASP Sample App

3. SFImpersonator running called apps

4. IE App calling ASP.

5. newbie - calling apps using vb scripting

6. Calling a win32 DLL in a vb app - Need help

7. SFImpersonator running called apps

8. Close or control any windows app from command line or batch file by calling WinAPI

9. Easy way to convert web based ASP app to standalone app

10. Whats the best way to execute a VB app from another VB app

11. stop app, run script, restart app

12. WSH calls VBA or VBA calls WSH

 

 
Powered by phpBB® Forum Software