INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: View not being restored at startup  (Read 1651 times)

dhiggins

  • Regular Member
  • World Citizen
  • ***
  • Posts: 126
View not being restored at startup
« on: November 30, 2011, 10:29:19 pm »

I've got 17.0.33 of MC and it seems that detached display views aren't working quite right.

 I've created 2 display views and linked, then detached them. So Each is showing different stuff (a visualization in one, track info in the other).

I've set the STARTUP option to restore with the last loaded view.

But, when I close and restart MC, the detached views don't come up.

Am I missing some setting somewhere to cause them to really be restored where they originally were (say, on a second or third monitor)?

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: View not being restored at startup
« Reply #1 on: December 01, 2011, 02:05:02 pm »

Detached displays don't restore when you start MC.  They do remember their positioning and size (including fullscreen) when you close and re-open MC, but you have to manually detach them again first.

You CAN do it with a script though.

I have a system that runs a detached display on our Video Wall at the office, and I have a script that auto-loads MC on startup, starts playing a particular playlist, and then detaches the display.  It works great for if the system needs to be rebooted.

To Detach the currently active display:
Code: [Select]
mc17.exe /MCC 10037, 1
To re-attach the currently active display:
Code: [Select]
mc17.exe /MCC 10037, 0
To toggle back and forth:
Code: [Select]
mc17.exe /MCC 10037, -1
It does work even if playback is stopped.

You can make any of these commands Zone specific by appending a Zone Index to the end of the command after a colon.  The Zone Index is zero based (so, zone 1 is :0, zone 2 is :1, etc).  So, for example, to send the above Detach the Display command to the second defined zone, you'd use this command:

Code: [Select]
mc17.exe /MCC 10037, 1:1
Lastly, the Detach Display MCC command described above ONLY works for currently running copies of MC.  So, if MC might not be running already, you need to launch it first.  If you just need to launch MC first in a script, simply call the mc17.exe command by itself in your script or BAT file like this:

Code: [Select]
mc17.exe
mc17.exe /MCC 10037, 1:1

(Note: Don't use the mc17.exe /Power command line option because that will close MC if it is already running, like a power-button toggle.  Just call mc17.exe by itself.)
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

dhiggins

  • Regular Member
  • World Citizen
  • ***
  • Posts: 126
Re: View not being restored at startup
« Reply #2 on: December 01, 2011, 03:26:08 pm »

@glynor

Perfect! Thanks a ton. I'd forgotten about the command line stuff (though I'd never realized that you could control the display elements like that in any event).

One slight comment, I've found that just running MC17.exe, then immediately running the detach commands doesn't work, probably because MC is still loading.

So I added a
SLEEP 10s
command, to give it a little time to finish loading. (the sleep command is a little command line exe I picked up off the internet ages ago).

Looking good so far. Thanks again!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: View not being restored at startup
« Reply #3 on: December 01, 2011, 06:13:10 pm »

One slight comment, I've found that just running MC17.exe, then immediately running the detach commands doesn't work, probably because MC is still loading.

See my post here too (reply #4)

http://yabb.jriver.com/interact/index.php?topic=65601.0
Logged
The opinions I express represent my own folly.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: View not being restored at startup
« Reply #4 on: December 01, 2011, 08:51:28 pm »

I thought that needing to sleep the script might have been a problem, and almost mentioned it, but didn't because I wasn't sure.  I don't usually do these kinds of scripts with BAT files because they're clunky.  Another way is via Windows Script Host.  For example, paste this into a text file and save it as scriptname.wsf:

Code: [Select]
<package>
<job id="vbs">
<script language="VBScript">

'Create our handy dandy Shell object
set WshShell = WScript.CreateObject("WScript.Shell")

'SCRIPT ACTUALLY STARTS DOING STUFF HERE

'Start MC
WshShell.Run "mc17.exe"

'Pause for a bit
WScript.Sleep 1000

'Detach display on Zone 2
WshShell.Run "mc17.exe /MCC 10037, 1:1"
</script>
</job>
</package>

The "7" part of the WshShell.Run command sets the resulting window's mode to "Minimize. The active window remains active."  This means you don't have to see the command line output.  You can also hide it completely by using 0 instead.  The "%comspec% /c" part just runs the command in a "proper" command line environment, and is almost certainly not necessary for the mc17.exe commands (and omitting that would probably avoid the whole command line interface thing anyway).

That doesn't require looping or pinging or installing any additional software.

EDIT:  Running inside a %comspec% command line shell is absolutely not necessary for this, and it makes it simpler without it, so I modified the above script.  The mc17.exe doesn't have any UI in this case of any kind, so there's no reason to use the shell and show or hide any window.

I also increased the timeout for the sleep command.  The number is in milliseconds, so that's 1 second of delay.  If you need more, just add additional thousands.

If you want to know more about the WScript.Shell object, check out this article on Microsoft's TechNet.  There's all sorts of awesome filesystem manipulation you can do and other commands.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/
Pages: [1]   Go Up