Page 3 of 5

Posted: Wed Dec 19, 2007 3:52 pm
by Steegy
The visualisation in MM can be launched from a script by using the following code:

Code: Select all

Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "MediaMonkey"
'SDB.Tools.Sleep 100
WshShell.SendKeys "^(%v)"
'SDB.Tools.Sleep 1000
Because MM2 doesn't support the Tools.Sleep commands yet, I commented them out. But this means that usually they don't work correctly. On MM3, when the comments are removed, the code should work so you can use it in the script, to toggle the MM visualisation visibility.

Posted: Thu Dec 20, 2007 8:46 am
by MM3 monkey
Sorry, Steegy but I only understand about 50% of that and the upshot is I haven't got a clue!

If I take it slowly...
Steegy wrote:The visualisation in MM can be launched from a script by using the following code:

Code: Select all

Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "MediaMonkey"
'SDB.Tools.Sleep 100
WshShell.SendKeys "^(%v)"
'SDB.Tools.Sleep 1000
1.Does that mean the milkdrop would start automatically on MM start-up?
2. When you say "a" script, do you mean I have to write a new one or is the code to be added somewhere in your script?
Steegy wrote:Because MM2 doesn't support the Tools.Sleep commands yet
... er, no idea what they are
Steegy wrote:I commented them out.
Hooray, something I understand. I know that anything in
a script with ' at the beginnig of the line is ignored by the script.
Steegy wrote:But this means that usually they don't work correctly.
As I say, I don't know what they [the Tools.Sleep commands ] are.
Steegy wrote:On MM3, when the comments are removed, the code should work so you can use it in the script, to toggle the MM visualisation visibility.
I think I'd better go look at your script and see if removing the comments is what your suggesting. But even then how do I toggle the vis visibilty?

I don't understand why you say "MM2 doesn't support the Tools.Sleep commands yet" MM3's as good as released already.

Your post suggests that you have mistaken me for someone with a working brain. :)

Posted: Thu Dec 27, 2007 2:48 pm
by nynaevelan
Steegy wrote:The visualisation in MM can be launched from a script by using the following code:

Code: Select all

Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "MediaMonkey"
'SDB.Tools.Sleep 100
WshShell.SendKeys "^(%v)"
'SDB.Tools.Sleep 1000
Because MM2 doesn't support the Tools.Sleep commands yet, I commented them out. But this means that usually they don't work correctly. On MM3, when the comments are removed, the code should work so you can use it in the script, to toggle the MM visualisation visibility.
For the programming illiterate, how do I make the above script for this embedder to start automatically with MM3?

Nyn

What's up with this?

Posted: Fri Jan 18, 2008 10:44 am
by fuzzynavel
Yeah, I second the question. How can I alter the script to do this automatically? I'm not sure I understand either...

Sorry!

Posted: Wed Jan 23, 2008 11:26 am
by Mrcapo
yep this is what am look for too.

Working

Posted: Fri Feb 01, 2008 4:05 pm
by aoejedimaster
I've got this to start working automatically on startup. Tested in 3.0.1.1127 with Media Monkey Gold, but I don't see any reason it wouldn't work in the free version either. I also turned down the delay between checking for resize, which could cause flickering on computers slower than mine. But this works flawlessly for me:

Code: Select all

Option Explicit

Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "MediaMonkey"
'SDB.Tools.Sleep 100
WshShell.SendKeys "^(%v)"
'SDB.Tools.Sleep 1000

Dim MI, Panel, Tmr
Const TimerTimeout = 100

Sub OnStartup

    Set MI = SDB.UI.AddMenuItem(SDB.UI.Menu_View, 1, -3)
    MI.Caption = "Visualisation Panel"
    MI.IconIndex = 65
    MI.ShortCut = "Ctrl+Alt+B"
    MI.Hint = "Show the panel for the embedded visualisation"
    Script.RegisterEvent MI, "OnClick", "MIClick"
    
    
    Set Panel = SDB.UI.NewDockablePersistentPanel("VisualisationEmbedder_Panel")
    If Panel.IsNew Then
        Panel.DockedTo = 2
        Panel.Common.Width = 200
        Panel.Common.Height = 200
    End If
    Panel.Caption = "Embedded Visualisation"
    Set SDB.Objects("VisualisationEmbedder_Panel") = Panel        'Storing the Panel in MM's Objects array is only needed to keep it alive the whole time
    Script.RegisterEvent Panel, "OnClose", "PanelClosed"
    Script.RegisterEvent Panel.Common, "OnResize", "PanelResized"


	If SDB.IniFile.StringValue("VisualisationEmbedder", "PanelVisible") = "True" Then
        RepositionAndResize(Null)
	    Panel.Common.Visible = True
        MI.Checked = True
        
        Set Tmr = SDB.CreateTimer(TimerTimeout)
        Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
	Else
	    Panel.Common.Visible = False
        MI.Checked = False
	End If

End Sub


Sub MIClick(MI) 
    
    MI.Checked = Not MI.Checked
    Panel.Common.Visible = MI.Checked
	SDB.IniFile.StringValue("VisualisationEmbedder", "PanelVisible") = MI.Checked
	
    If MI.Checked Then
        RepositionAndResize(Null)
        
        Set Tmr = SDB.CreateTimer(TimerTimeout)
        Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
    Else
        Set Tmr = Nothing
    End If

End Sub


Sub PanelClosed(Panel) 

    MI.Checked = False
    SDB.IniFile.StringValue("VisualisationEmbedder", "PanelVisible") = "False"
    Set Tmr = Nothing

End Sub


Sub PanelResized(Panel)

    Call CreateObject("WScript.Shell").Run("""" & SDB.ApplicationPath & "Scripts\Auto\Visualisation Embedder.exe"" reposition", 0, 0)

End Sub


Sub RepositionAndResize(ML) 

    Dim WShell : Set WShell = CreateObject("WScript.Shell")
    Call WShell.Run("""" & SDB.ApplicationPath & "Scripts\Auto\Visualisation Embedder.exe"" embed", 0, 0)
    Call WShell.Run("""" & SDB.ApplicationPath & "Scripts\Auto\Visualisation Embedder.exe"" reposition", 0, 0)

End Sub

Paste that over the current contents of your .vbs file.

All I did was uncomment all lines, add the autostart visualization clip of coding provided in this thread, reduce the timer by a factor of 100, and changed the hotkey to ctrl+alt+b for those of you who are annoyed by the analyze volume conflict.

This works great for me, hope I've helped everyone else too!

Posted: Fri Feb 01, 2008 5:19 pm
by runtherisk
Works Great!! Thanks

Posted: Fri Feb 01, 2008 7:27 pm
by Fraxav
Hey, that really works fine.
But I'm still wondering if this script could become soon a pre-installed feature of MM3...and with the possibility to hide the title bar :roll: :(

Posted: Sat Feb 02, 2008 6:10 pm
by scrapqueen
I am having trouble with this script. I get the following error message: "Visualization Embedder.exe. The application failed to initialize properly (0xc0000142). Click on OK to terminate the application."

Clicking ok doesn't cancel the program and turns into an endless loop. I did ctrl+al+del to look at the processes running and this program had multiplied many times. I am running the latest release of MM3 free version.

Posted: Tue Feb 05, 2008 6:21 pm
by aoejedimaster
scrapqueen wrote:I am having trouble with this script. I get the following error message: "Visualization Embedder.exe. The application failed to initialize properly (0xc0000142). Click on OK to terminate the application."

Clicking ok doesn't cancel the program and turns into an endless loop. I did ctrl+al+del to look at the processes running and this program had multiplied many times. I am running the latest release of MM3 free version.
I assume you've tried this more than once? If not, try it several times and see if it was just a random glitch.

Otherwise, try a re-download? And maybe clear out any other scripts or extensions you are running to see if there's a conflict. And make sure your visualization is set to milkdrop.

Posted: Wed Feb 06, 2008 6:20 pm
by scrapqueen
Ok. I tried this script with a fresh install of MM3 and I keep getting the same error. I also tried it on another computer with an older install of MM3 and same thing happened. I even removed the visualization embedder.exe. I get a message about an error on line 78 I think.

Posted: Fri Feb 08, 2008 12:52 pm
by TheHawk
Yes, if got the same error.

When I comment

Code: Select all

Set Tmr = SDB.CreateTimer(TimerTimeout)
Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
out, there is no error, but the visualisation isn't embedded too. :cry:

Posted: Fri Feb 08, 2008 1:05 pm
by Guest
TheHawk wrote:Yes, if got the same error.

When I comment

Code: Select all

Set Tmr = SDB.CreateTimer(TimerTimeout)
Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
out, there is no error, but the visualisation isn't embedded too. :cry:
Scrapqueen wrote:Ok. I tried this script with a fresh install of MM3 and I keep getting the same error. I also tried it on another computer with an older install of MM3 and same thing happened. I even removed the visualization embedder.exe. I get a message about an error on line 78 I think.
Hmmm it's working great for me, post your hardware?

Posted: Sat Feb 09, 2008 8:52 am
by Steegy
Browse to the "Visualization Embedder.exe" program, right click on it > Properties > Unblock > OK.
Try it now.

As security precaution, potentially dangerous files are tagged as "dangerous" by Internet Explorer, when downloaded to your computer. You have to Unblock them manually to say you trust them.

Cheers
Steegy

Posted: Sat Feb 09, 2008 8:54 am
by TheHawk
I now tried to install it on my laptop, but I got the same problem. So it can't really be a hardware problem. This was also a new, clean windows XP installation, so a conflict with another program isn't possible too. That means it must be my fault.

Here the steps I did:

- I downloaded MM and installed it
- I started it, and it worked, so I closed it again
- I downloaded the "Newer versions of the files" form Steegys post of the 21 September 2006 11:49 pm and put both in ...MediaMonkey\Scrips\Auto
- I started MM and after a few seconds I got the same error again

PS: I'm using a German XP version, so MM is stored in "C:\Programme\MediaMonkey" but I think this can't be a problem