Hi all,
How do I get my unhosted VBScript to show up in the script manager?.  According 
to the docs I should use the ClientIdentify method of the Application Object 
inconjunction with ClientInformation but I don't seem to be getting it right.  
Below is Doug's example script he left us with on friday only I wrote a 
function using win32 process wish does give me the Script's PID but when I give 
this to the ClientIdentify method nothing shows up in the script manager still. 
I know that it is giving the correct information because if you remove the "'" 
from the three lines with in the function you get full path name of where the 
script was run from and Object name (the object process that started the 
script).. Please help.
Begin VBScript
Dim MyHotKey, keyFlag, PID
keyFlag = False
Set WE = CreateObject("WindowEyes.Application")
WE.ClientIdentify(GetProcessId("wscript.exe"))
PID = GetProcessId("wscript.exe")
WE.Speech.Speak "this is the process ID" & " " & PID 

set MyHotKey = WE.Keyboard.RegisterHotkey("control-shift-c", 
GetRef("helloWorld"))
While Not keyFlag
   wscript.Sleep 100
Wend
WE.Speech.Speak "all done, thanks for playing"
Sub helloWorld()
   WE.Speech.Speak "hello world"
   keyFlag = True
End Sub

Function GetProcessId(scriptObject)
Set objSWbemServices = GetObject ("WinMgmts:Root\Cimv2")
Set colProcess = objSWbemServices.ExecQuery _
("Select * From Win32_Process")
For Each objProcess In colProcess
If InStr (objProcess.CommandLine, WScript.ScriptName) <> 0 And objProcess.Name 
= scriptObject Then
GetProcessId = objProcess.ProcessId 

' WScript.Echo "object name" & " " & objProcess.Name, _
' "process Id" & " " & objProcess.ProcessId, _' 
' "full path and file name" & " " & objProcess.CommandLine
End If
Next
End Function



      

Reply via email to