steve44
asked on
Appactivate a program (Zoom Player) with vbscript function
I am using an HTA file with the following vbscript to try and activate Zoom Player window.
but it does not work. I believe that this program can NOT be activated by the title. There is no title bar that displays Zoom Player. Is there a way to activate it using the process name or ID? (zplayer.exe is the process)
This is what does not work:
<SCRIPT LANGUAGE="VBScript">
function ZoomActivate()
Set objShell = CreateObject("WScript.Shel l")
objShell.AppActivate ("Zoom Player")
end function
</SCRIPT>
but it does not work. I believe that this program can NOT be activated by the title. There is no title bar that displays Zoom Player. Is there a way to activate it using the process name or ID? (zplayer.exe is the process)
This is what does not work:
<SCRIPT LANGUAGE="VBScript">
function ZoomActivate()
Set objShell = CreateObject("WScript.Shel
objShell.AppActivate ("Zoom Player")
end function
</SCRIPT>
ASKER
I tested it as you suggested but it doesn't work that way either. I did test my hta with notepad and that does work.
On microsofts website http://msdn2.microsoft.com/en-us/library/dyz95fhy(VS.71).aspx
they state "You can use AppActivate only with processes that own windows. " I think maybe
Zoom Player is one of those types.
On microsofts website http://msdn2.microsoft.com/en-us/library/dyz95fhy(VS.71).aspx
they state "You can use AppActivate only with processes that own windows. " I think maybe
Zoom Player is one of those types.
What if you tried:
Set objShell = CreateObject("WScript.Shel l")
Set objExec = objShell.Exec("C:\Program Files\Zoom\Zplayer.exe")
objShell.AppActivate objExec.ProcessID
Regards,
Rob.
Set objShell = CreateObject("WScript.Shel
Set objExec = objShell.Exec("C:\Program Files\Zoom\Zplayer.exe")
objShell.AppActivate objExec.ProcessID
Regards,
Rob.
Or, for the Window title, when you go to the Task Manager, and view the Programs tab, try the exact text that is written there for the program....
Rob.
Rob.
ASKER
Rob, I tried your code and it doesn't work either. I tried both as a single vbs file and plugged into the hta file.
I f I load a video into the player, and then use the name of the video as the title, it does activate using the code i first posted from the hta file. . I should point out that zoom player does not look like a regular window. It is customizable through skinning. It has no tittle until a video is loaded.
It does list though as "Zoom Player" in the application tab of taskmanger and zplayer.exe in the process tab.
It is also highly controllable through keyboard shortcuts. That is what i'm trying to do with the hta file used as a toolbar.
I f I load a video into the player, and then use the name of the video as the title, it does activate using the code i first posted from the hta file. . I should point out that zoom player does not look like a regular window. It is customizable through skinning. It has no tittle until a video is loaded.
It does list though as "Zoom Player" in the application tab of taskmanger and zplayer.exe in the process tab.
It is also highly controllable through keyboard shortcuts. That is what i'm trying to do with the hta file used as a toolbar.
OK, what if you run this:
'==============
' Source: http://www.microsoft.com/technet/scriptcenter/topics/office/tasks.mspx
' Tasks Collection: http://msdn2.microsoft.com/en-us/library/aa212447(office.11).aspx
strAppName = "Zoom Player"
Const wdWindowStateNormal = 0
Set objWord = CreateObject("Word.Applica tion")
Set objShell = CreateObject("WScript.Shel l")
objWord.Visible = False
Set colTasks = objWord.Tasks
If colTasks.Exists(strAppName ) Then
colTasks(strAppName).Activ ate
'colTasks("Solitaire").Win dowState = wdWindowStateNormal
objShell.SendKeys "(%{F4})"
MsgBox strAppName & " was just closed."
Else
MsgBox strAppName & " is not running"
End If
objWord.Quit
'=============
Regards,
Rob.
'==============
' Source: http://www.microsoft.com/technet/scriptcenter/topics/office/tasks.mspx
' Tasks Collection: http://msdn2.microsoft.com/en-us/library/aa212447(office.11).aspx
strAppName = "Zoom Player"
Const wdWindowStateNormal = 0
Set objWord = CreateObject("Word.Applica
Set objShell = CreateObject("WScript.Shel
objWord.Visible = False
Set colTasks = objWord.Tasks
If colTasks.Exists(strAppName
colTasks(strAppName).Activ
'colTasks("Solitaire").Win
objShell.SendKeys "(%{F4})"
MsgBox strAppName & " was just closed."
Else
MsgBox strAppName & " is not running"
End If
objWord.Quit
'=============
Regards,
Rob.
If that doesn't work, see if the Tasks collection actually sees something of Zoom Player by using this:
'=========
Set objWord = CreateObject("Word.Applica tion")
Set objShell = CreateObject("WScript.Shel l")
objWord.Visible = False
Set colTasks = objWord.Tasks
strApps = "Running applications:"
For Each objTask In colTasks
If objTask.Visible = True Then
strApps = strApps & vbCrLf & objTask.Name
End If
Next
MsgBox strApps
objWord.Quit
'=========
Regards,
Rob.
'=========
Set objWord = CreateObject("Word.Applica
Set objShell = CreateObject("WScript.Shel
objWord.Visible = False
Set colTasks = objWord.Tasks
strApps = "Running applications:"
For Each objTask In colTasks
If objTask.Visible = True Then
strApps = strApps & vbCrLf & objTask.Name
End If
Next
MsgBox strApps
objWord.Quit
'=========
Regards,
Rob.
ASKER
Hi Rob,
When I run the 1st code and zoom player is not running I get the message box "zoom player is not running". When zoom player is running I get a Windows Script Host error
"cannot activate application"
charactor 11 line 5
800A11F9
When I run the 2nd code and zoom player IS running, it does NOT appear in the message box of running apps.
thanks for your effort. I am increasing the points to 250
When I run the 1st code and zoom player is not running I get the message box "zoom player is not running". When zoom player is running I get a Windows Script Host error
"cannot activate application"
charactor 11 line 5
800A11F9
When I run the 2nd code and zoom player IS running, it does NOT appear in the message box of running apps.
thanks for your effort. I am increasing the points to 250
ASKER
I'm going to be gone for about 10 days. be back 8-21-07. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I believe you are right Rob. Thanks for your help.
Sorry for the bad news Steve.....it just looks like a special case Application.....
Rob.
Rob.
Set objShell = CreateObject("WScript.Shel
objShell.AppActivate ("Zoom Player")
make sure you have Zoom Player open before running it and let us know what happens.