Code: Select all
Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "MediaMonkey"
'SDB.Tools.Sleep 100
WshShell.SendKeys "^(%v)"
'SDB.Tools.Sleep 1000
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?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
... er, no idea what they areSteegy wrote:Because MM2 doesn't support the Tools.Sleep commands yet
Hooray, something I understand. I know that anything inSteegy wrote:I commented them out.
As I say, I don't know what they [the Tools.Sleep commands ] are.Steegy wrote:But this means that usually they don't work correctly.
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?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.
For the programming illiterate, how do I make the above script for this embedder to start automatically with MM3?Steegy wrote:The visualisation in MM can be launched from a script by using the following code: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.Code: Select all
Dim WshShell : Set WshShell = CreateObject("WScript.Shell") WshShell.AppActivate "MediaMonkey" 'SDB.Tools.Sleep 100 WshShell.SendKeys "^(%v)" 'SDB.Tools.Sleep 1000
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
I assume you've tried this more than once? If not, try it several times and see if it was just a random glitch.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.
Code: Select all
Set Tmr = SDB.CreateTimer(TimerTimeout)
Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
TheHawk wrote:Yes, if got the same error.
When I commentout, there is no error, but the visualisation isn't embedded too.Code: Select all
Set Tmr = SDB.CreateTimer(TimerTimeout) Script.RegisterEvent Tmr, "OnTimer", "RepositionAndResize"
Hmmm it's working great for me, post your hardware?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.