Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How to GetObject from a process id...?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,65407
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to GetObject from a process id...?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 How to GetObject from a process id...? - 10/22/2008 4:08:00 AM   
  chappaai

 

Posts: 1
Score: 0
Joined: 10/22/2008
Status: offline
VBScript on Windows XP

I don't know if it's possible, but it seems as though it should be.  I can get all the process id's for a given application (for example, multiple Excel sessions) with...

GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * from Win32_Process Where Name = 'excel.exe'")

...and then by looping through the collection's ProcessId properties I can get a unique process id for each running Excel session.  But how can I use that information to get a handle to the application and thus access its object model?

GetObject(,"Excel.Application")  ...will return an (arbitrary?) instance of the application, but not necessarily the one I'm interested in.  By looping through the process id's I should be able to find the instance which meets a particular condition and set a handle to it, but I can't find a way to translate the process id into something compatible with GetObject.  Am I trying to graft wings onto a pig here?
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to GetObject from a process id...? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts