Automating a script when click on tab

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Automating a script when click on tab

Re: Automating a script when click on tab

by trixmoto » Tue Oct 23, 2012 7:33 pm

By the way, when I create my own debug file, I typically do it with a procedure like this...

Code: Select all

Sub out(str)
  Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
  Dim loc : loc = SDB.TemporaryFolder&"\Scriptname.log"
  Dim txt : txt = SDB.ToAscii(str)
  Dim logf : Set logf = fso.OpenTextFile(loc,8,True)
  If Err.Number <> 0 Then
    logf.WriteLine("["&Err.Number&"] "&Err.Description&" ("&Err.Source&")")
    Err.Clear
  End If
  Call logf.WriteLine(Time&" "&txt)
  Call logf.Close
End Sub

Re: Automating a script when click on tab

by Nanya » Tue Oct 23, 2012 5:34 pm

It would be nice and helpful that you create new Topic/Mantis BUG with list of events that could be added in 4.1 as we are approaching beta period.

So it is right time for this.
Peke, perhaps you should take a look at the wishlist, as much of this still hasn't been implemented: http://www.mediamonkey.com/forum/viewto ... f=2&t=7973
Nor even added to the "Official" list... http://www.mediamonkey.com/forum/viewtopic.php?t=7978

Re: Automating a script when click on tab

by trixmoto » Tue Oct 23, 2012 5:11 pm

The best way to test would probably be to register a function which has a MsgBox in it, so that you get a popup. Or you could write your own logfile - or use OutputDebugStringMM if you're using a debug version of MM.

Re: Automating a script when click on tab

by Peke » Tue Oct 23, 2012 4:47 pm

It would be nice and helpful that you create new Topic/Mantis BUG with list of events that could be added in 4.1 as we are approaching beta period.

So it is right time for this.

Re: Automating a script when click on tab

by martinstephenbanks » Tue Oct 23, 2012 6:37 am

Thanks Trixmoto, whilst it sounds like there is no easy answer to this, you appear to have some possibilities I can explore. Not sure if I mentioned but working with MM I am very new at :)

So, do you know how I could test to see if the OnChangedSelection fires when I click this particular tab? Like is there a log I could watch or anything like that? If I can see it firing I can hopefully run an IF to see if this tab has the focus and run a refresh.

Many thanks,
Martin Banks

Re: Automating a script when click on tab

by trixmoto » Thu Oct 18, 2012 6:21 pm

There are a number of application events but not one specifically for changing tabs. When you change tabs I suspect it would fire OnTrackListFilled though, so you could check which tab is focused at this point and do a refresh - although you'd need to be careful to avoid an infinite loop, as the refresh would cause this event to fire as well. Maybe OnChangedSelection would be better - this fires when you click on a different node, but I don't know if it fires when changing tabs or not.

Automating a script when click on tab

by martinstephenbanks » Thu Oct 18, 2012 7:46 am

Hi All,

I know you can automate scripts on opening MM by putting them in the auto folder but is it possible to have them run automatically when you do something specific?

I'll explain why I ask and that may help you to answer better: I leave open multiple tabs so that I don't have to wait for some of them to rebuild (I have a large collection) each time, one of which is a playlist I made that shows me all the songs that have ever played but have not been rated (simply playlist count > 0 AND Rating = Unknown). However, each time I go to the tab I have to refresh it. Is there a way to have MM detect that I have clicked on this tab and run a refresh automagically?

For example, does it keep some kind of log of my movements that I could have it detect this tab within? Or can the tab itself be given some code to perform on 'Got Focus'?

Thanks for all your help and brain cells :)
Martin Banks

Top