Request for embedding visualisation into dockable panel

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Wed Dec 19, 2007 3:52 pm

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.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

MM3 monkey
Posts: 445
Joined: Mon Aug 27, 2007 2:34 am

Post by MM3 monkey » Thu Dec 20, 2007 8:46 am

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. :)
MMW 4.1.9.1764|MMA 1.1.3.0482|Android 5.0|Win 8.1 64 bit

nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan » Thu Dec 27, 2007 2:48 pm

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
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files

fuzzynavel

What's up with this?

Post by fuzzynavel » Fri Jan 18, 2008 10:44 am

Yeah, I second the question. How can I alter the script to do this automatically? I'm not sure I understand either...

Sorry!

Mrcapo
Posts: 10
Joined: Wed Jan 23, 2008 9:50 am
Location: England

Post by Mrcapo » Wed Jan 23, 2008 11:26 am

yep this is what am look for too.

aoejedimaster

Working

Post by aoejedimaster » Fri Feb 01, 2008 4:05 pm

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!

runtherisk
Posts: 75
Joined: Sun Mar 05, 2006 3:05 pm
Location: PA, USA

Post by runtherisk » Fri Feb 01, 2008 5:19 pm

Works Great!! Thanks

Fraxav
Posts: 369
Joined: Fri Nov 02, 2007 5:19 pm
Location: Italia

Post by Fraxav » Fri Feb 01, 2008 7:27 pm

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: :(
I don't have no time for no MediaMonkey buisness...

Fraxav uses a Windows XP Home Edition SP2 on an Acer Aspire 5670 laptop with an Intel Core Duo T2300 (1.66 GHz) processor, ATI Mobility Radeon X1400 512 MB, 100 GB Hard Disc and 1 GB DDR2 Ram.

scrapqueen
Posts: 28
Joined: Fri Mar 02, 2007 9:45 pm
Location: USA
Contact:

Post by scrapqueen » Sat Feb 02, 2008 6:10 pm

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.

aoejedimaster

Post by aoejedimaster » Tue Feb 05, 2008 6:21 pm

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.

scrapqueen
Posts: 28
Joined: Fri Mar 02, 2007 9:45 pm
Location: USA
Contact:

Post by scrapqueen » Wed Feb 06, 2008 6:20 pm

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.

TheHawk

Post by TheHawk » Fri Feb 08, 2008 12:52 pm

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:

Guest

Post by Guest » Fri Feb 08, 2008 1:05 pm

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?

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Location: Belgium
Contact:

Post by Steegy » Sat Feb 09, 2008 8:52 am

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
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).

TheHawk

Post by TheHawk » Sat Feb 09, 2008 8:54 am

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

Post Reply