Post Reply
AndyA 2014-01-27 01:37
I installed UltraMon yesterday and am evaluating it. I'm running Windows 7 Pro x64 with an integrated Intel HD Graphics 4600 video controller connected to a Dell 1907FP monitor and a Panasonic HD TV.
Via VBS script, I am trying to launch WMP, choose a video file, then switch WMP to the TV and view it in full-screen mode.
I was not able to get that to work, so I simplified to a simple launch of WMP, then switch to the TV in full-screen. That doesn't work, either.
Here's my code, which duplicates your sample code. The TV is already enabled and the UltraMon system tray icon shows two monitors:
Const SHOWSTATE_MAXIMIZED = 3
Dim oUM : Set oUM = CreateObject("UltraMon.Utility")
Dim oUMWin : Set oUMWin = CreateObject("UltraMon.Window")
If oUM.Run("C:\Program Files (x86)\Windows Media Player\wmplayer.exe") = True Then
MsgBox "PID = " & oUM.ProcessID
If oUMWin.Find("", "", 0, oUM.ProcessID, 5000) = True Then
oUMWin.Monitor = 2
oUMWin.ShowState = SHOWSTATE_MAXIMIZED
oUMWin.ApplyChanges 0
MsgBox "status of ApplyChanges?"
End If
End If
When the script is run, WMP starts up, the correct PID is displayed, and then WMP remains on the Dell monitor. The HD TV only displays the wallpaper.
If I configure a shortcut to start up WMP maximized on the HD TV, UltraMon does what's asked.
How do I move WMP to the TV via script?
regards, AndyA
|
Christian Studer 2014-01-27 12:44
Try using the GetAppMainWindow method instead of Find, that will fix the problem:
If oUMWin.GetAppMainWindow(oUM.ProcessID, 5000) = True Then
When you're calling the Find method without specifying either a title or window class, it will return the topmost window of the process, which could be something like the window for the UltraMon buttons, and you would then end up moving that instead of the actual application window.
Christian Studer - www.realtimesoft.com
|
AndyA 2014-01-27 17:33
FOA, thanks for your prompt reply.
GetAppMainWindow worked well to move the WMP window to the TV and maximize it. However, it did not work satisfactorily when WMP was started up with an .AVI file as an argument -- the WMP window occupied about one twelfth of the TV screen, anchored in the upper left.
Is there a particular syntax for loading a file into WMP and then moving it to another monitor?
(I can't see the TV from the PC. I need to manipulate the window on the PC before moving it to the TV.)
Thanks again for your help.
regards, AndyA
|
Christian Studer 2014-01-28 13:53
Not sure what might cause this, works fine for me both on Windows 7 and 8.1 when passing a video file on the command line. I also tested with the fullscreen switch, that worked fine as well:
If oUM.Run("""C:\Program Files (x86)\Windows Media Player\wmplayer.exe"" ""C:\My video.avi"" /fullscreen") = True Then
Does WMP take more than 5 seconds to complete startup? If yes, try increasing the timeout for the GetAppMainWindow call, for example to 10000 milliseconds.
Christian Studer - www.realtimesoft.com
|
AndyA 2014-02-04 05:00
Retrying WMP with an .AVI file as argument did *not* produce the windowing behavior I saw a week ago. (Go figure.)
Using the /fullscreen argument worked correctly.
However, using the ShowState = SHOWSTATE_MAXIMIZED command (instead of /fullscreen) displayed the WMP window full screen with the task bar and WMP controls on the bottom. I'll use the /fullscreen argument instead.
Right now, the scripting is working satisfactorily.
Thanks very much for your help.
regards, AndyA
|
Post Reply
|