Post Reply

Forums -> UltraMon™ -> Ultramon shortcut problems with dynamic parameters
KB   2003-03-19 16:47
Hi,

First I want to say GREAT utility I use it all the time! I'm hoping that you can help me with a problem I've been having though...

I can't seem to figure out how to get UltraMon's shortcuts to work properly when I want to launch an application and pass that application a dynamic variable. Let me try to explain...

I use an application that allows you to specify a custom media player so that you can launch videos from within the application via a context menu option. I would like to have the media player always open in the same location. I thought I would be able to do this by simply creating an UltraMon shortcut and specifying the shortcut itself as the media player. Unfortunately this doesn't seem to work.

It appears that UltraMon doesn't (can't?) pass along the parameter specifing the video file to the media player?

The syntax that is used by the application's context menu option (at least as best as I can tell after doing a little testing) is simply to append the path to the video file after the full path to the media player.

For example it would be someting like the following:
c:\path\mediaplayer.exe c:\path\video.ext

Or an alternate method I was trying to make work:
c:\path\mediaplayershortcut.lnk c:\path\video.ext

I'm assuming that the problem comes from the fact that UltraMon shortcuts pass their own configuration parameters to UltraMonShortcuts.exe

I'm fairly confident that this is at least related to the problem because I did a little testing from the commad-line and discovered the following.

This following command works fine, opening the media player and automatically launching the video.

c:\path\mediaplayer.exe c:\path\video.exe

This next command also works as expected. The media player opened and was positioned properly. All I did was create an UltraMon shortcut to the media player and then manually launch it from the command prompt.

c:\path\UltraMonShortcuts.exe /l c:\path\shortcut.umshortcut

But the following is where the trouble begins.

c:\path\UltraMonShortcuts.exe /l c:\path\shortcut.umshortcut c:\path\video.ext

Suprisingly NOTHING at all happens?! The media player wasn't even opened... I think this is directly related to why I can't get the media player to launch properly from within my application. Is there any way to get UltraMon to pass along to the application it is opening any additional parameters it receives???

Is this type of functionality even possible with UltraMon? Am I even thinking along the right lines?!?

Thanks for your time and all the hard work you put into an awesome utility!
Christian Studer   2003-03-20 00:13
Hi KB,

this isn't supported, command-line arguments are stored in the .umshortcut file and can't be updated dynamically. I'll consider adding support for this in a future release.

You could do this with a custom script though. You can send me the .umshortcut file to support@realtimesoft.com and I'll create a script which does the same and accepts the video file name as an argument.

Christian Studer - www.realtimesoft.com
alFkatre   2003-09-01 07:32
Hello Christian,

Is it possible that you add such a script on your website?

Thank you
Christian Studer   2003-09-03 10:00
The following script takes a single argument, the video file, then starts the specified video player and moves the window to the specified position.

You'll need to customize the 3 first lines of the script.

Const VIDEO_PLAYER = "C:\Program Files\Windows Media Player\wmplayer.exe"
Const POS_LEFT = 100
Const POS_TOP = 100

Set util = CreateObject("UltraMon.Utility")
If util.Run(VIDEO_PLAYER & " """ & WScript.Arguments(0) & """") = True Then
util.Sleep 1000 'wait 1 second, required for Windows Media Player

Set wnd = CreateObject("UltraMon.Window")
If wnd.GetAppMainWindow(util.ProcessId, 5000) = True Then
wnd.Left = POS_LEFT
wnd.Top = POS_TOP
wnd.ApplyChanges 0
End If
End If

Script download: LaunchVideo.zip

Christian Studer - www.realtimesoft.com
alFkatre   2003-09-04 08:02
Thanks a lot!
That's exactly what I was looking for!
But I've just modify the .vbs script a bit so it can launch my app. directly on 2nd monitor in fullscreen mode.

Some fellow ultramon users may be interested so here it is:

Const YOUR_APP = "D:\Program Files\appdir\appfile.exe"
Const SHOWSTATE_HIDDEN = 0
Const SHOWSTATE_MINIMIZED = 1
Const SHOWSTATE_NORMAL = 2
Const SHOWSTATE_MAXIMIZED = 3
Const SHOWSTATE_MAXIMIZED_DESKTOP = 4

Set util = CreateObject("UltraMon.Utility")
If util.Run(YOUR_APP & " """ & WScript.Arguments(0) & """") = True Then

Set wnd = CreateObject("UltraMon.Window")
If wnd.GetAppMainWindow(util.ProcessId, 5000) = True Then
wnd.Monitor = 2
wnd.ShowState = SHOWSTATE_MAXIMIZED
wnd.ApplyChanges 0
End If
End If


(Note that the script will return an error if no argument is passed.)
Avalon   2008-04-21 07:13
Hi 2 All. I am sorry but I am not able to use dynamic script. I type
UltramonShortcut.exe /l c:\LaunchVideo.vbs c:\video.avi and I have got nothing! It is not works at whole. What can be wrong there? Thanx

Dangerous
Christian Studer   2008-04-21 10:47
Did you already modify the script so that it launches the desired video player on your system? To do this, you'll need to edit the first line of the script, Const VIDEO_PLAYER = ...

Christian Studer - www.realtimesoft.com
Avalon   2008-04-22 00:08
Yes and the default also was right. I cant understand whats wrong. It is doing nothing-no action. What can be wrong?
Avalon   2008-04-22 04:28
And today I have got this:
http://img383.imageshack.us/img383/2891/monvv1.jpg
Please help me
OS Windows XP
Avalon   2008-04-22 04:33
And I lake usual unable to start script manually from command prompt(I really need it)but from Multimon context menu it works. How to use it from command line? Thanx
Christian Studer   2008-04-22 12:40
You would get this error when running the script without passing the name of the video to it.

To launch the script from a command prompt, run a command like this:

LaunchVideo.vbs "C:\Temp\My video.wmv"

Christian Studer - www.realtimesoft.com
Avalon   2008-05-02 08:33
Hi I am sorry but I have a question how I can get my media player application fullscreen in LaunchVideo script? For example mplayer I need to get it fullscreen on second monitor. How I can do that? Thank you.
Christian Studer   2008-05-02 12:30
UltraMon can't switch the application to fullscreen mode, but if the application has a command line switch to enable fullscreen mode you could use that from the script.

Christian Studer - www.realtimesoft.com
Avalon   2008-05-03 06:02
Yes please say me how to do it. For example MPlayer have hotkey "F" to switch to fullscreen
And also if it possibly I need to make video player window active (if smth happens). So there is 2 steps
1)Make video player window active
2)Switch to sullscreen mode
Please help me
Thank you.
Avalon   2008-05-03 06:18
And also please help me how to modify script to say to it to play selected file in cycle. I mean till programming termination.Thanks
Christian Studer   2008-05-03 13:18
You can't do this via UltraMon, the application would need to support enabling fullscreen mode via command line switch.

Christian Studer - www.realtimesoft.com
Avalon   2008-05-04 19:58
Thanx? but if it impossible to launch application fullscreen only at one monitor? Thanx
Avalon   2008-05-04 20:11
I simply need to launch app on one monitor when I am writing in script a string wnd.Monitor = 2 I see
http://img522.imageshack.us/img522/2498/ererzh7.jpg

Whats wrong?
Avalon   2008-05-04 21:38
Also please say me why construction

Const VIDEO_PLAYER = "C:\MPlayer-mingw32-1.0rc2\MPlayer-1.0rc2\mplayer.exe -fs"
Const POS_LEFT = 0
Const POS_TOP = 0

Set indDisp = CreateObject("UltraMon.IndDisp")
indDisp.DetachMonitors(Array(2))
procId = indDisp.DetachedApps.LaunchAndAdd(VIDEO_PLAYER & " """ & WScript.Arguments(0) & """ -loop 0", 2)
Set wnd = CreateObject("UltraMon.Window")
If wnd.GetAppMainWindow(procId, 1) = True Then
wnd.Left = POS_LEFT
wnd.Top = POS_TOP
wnd.ApplyChanges 0
End If

When I am trying to make fullscreen on only one monitor works only with monitorId=2 not 0 not 1 not 3 but 2 why?
Thank you
Christian Studer   2008-05-05 12:05
indDisp.DetachMonitors fails? What's the error you get?

Christian Studer - www.realtimesoft.com
Avalon   2008-05-06 05:06
I have got no error. Simply my problem its to show on second monitor a video file or power point presentation (may be for a long time)And the same time user can do everything on the first monitor. But When I am launch a script for example from multimon help (maximized notepad-independent displays) the window from fist mon can overlay the windows from second (detached) mon
So I could not understand how to make it works. I need to play video on second mon for a whole day for example. How to do it& Help me please. Thanx
Christian Studer   2008-05-06 12:55
UltraMon can't prevent the user from moving a window to the detached monitor, but once the user releases the mouse, the window will get moved back to the primary monitor.

Christian Studer - www.realtimesoft.com
Forums -> UltraMon™ -> Ultramon shortcut problems with dynamic parameters

Post Reply