• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2239
  • Last Modified:

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.Shell")
      objShell.AppActivate ("Zoom Player")
end function
</SCRIPT>
0
steve44
Asked:
steve44
  • 6
  • 5
1 Solution
 
tim_mcgueCommented:
Your HTA might not be complete.  Take it out of HTA to troubleshoot.  Put these two lines into a .vbs file and run it:

Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate ("Zoom Player")

make sure you have Zoom Player open before running it and let us know what happens.

0
 
steve44Author Commented:
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.
0
 
RobSampsonCommented:
What if you tried:
Set objShell = CreateObject("WScript.Shell")
Set objExec = objShell.Exec("C:\Program Files\Zoom\Zplayer.exe")
objShell.AppActivate objExec.ProcessID

Regards,

Rob.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
RobSampsonCommented:
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.
0
 
steve44Author Commented:
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.
0
 
RobSampsonCommented:
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.Application")
Set objShell = CreateObject("WScript.Shell")
objWord.Visible = False
Set colTasks = objWord.Tasks
If colTasks.Exists(strAppName) Then
    colTasks(strAppName).Activate
    'colTasks("Solitaire").WindowState = wdWindowStateNormal
    objShell.SendKeys "(%{F4})"
    MsgBox strAppName & " was just closed."
Else
    MsgBox strAppName & " is not running"
End If

objWord.Quit
'=============

Regards,

Rob.
0
 
RobSampsonCommented:
If that doesn't work, see if the Tasks collection actually sees something of Zoom Player by using this:
'=========
Set objWord = CreateObject("Word.Application")
Set objShell = CreateObject("WScript.Shell")
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.
0
 
steve44Author Commented:
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
0
 
steve44Author Commented:
I'm going to be gone for about 10 days. be back 8-21-07. Thanks
0
 
RobSampsonCommented:
I've set it up on a test machine, and from what I can tell, Word's tasks collection actually shows five instances of Zoom Player running (while Zoom Player is started), but all of those instances are *not* visible, even though you can *see* the Zoom Player User Interface.

This leads me to believe that the program creates it's own special GUI that cannot be programmable via a normal windows API method.  They have documentation on their own API that can be apparently used to intercept the messages, but I don't know if it will help with automation......

http://www.inmatrix.com/zplayer/comm.shtml

I will try to find time to look into this further.

Regards,

Rob.
0
 
steve44Author Commented:
I believe you are right Rob. Thanks for your help.
0
 
RobSampsonCommented:
Sorry for the bad news Steve.....it just looks like a special case Application.....

Rob.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now