No "OnStartup" event in MM4 [#8482]

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: No "OnStartup" event in MM4 [#8482]

Re: No "OnStartup" event in MM4 [#8482]

by jiri » Mon Oct 10, 2011 8:46 am

Definitely, at least for a limited time (of few year?) to allow update of scripts.

Jiri

Re: No "OnStartup" event in MM4 [#8482]

by ZvezdanD » Mon Oct 10, 2011 8:18 am

jiri wrote:OnStartup procedure of a script (if exists) is automatically called on startup. Since it the old way of calling script procedures, it would make sense to deprecate it in the next version of MM and rather implement the COM event.
Will you keep compatibility with the existing scripts after that implementation?

Re: No "OnStartup" event in MM4 [#8482]

by jiri » Mon Oct 10, 2011 2:18 am

So, just to summarize:

- There really haven't ever existed OnStartup COM event.
- OnStartup procedure of a script (if exists) is automatically called on startup. Since it the old way of calling script procedures, it would make sense to deprecate it in the next version of MM and rather implement the COM event.

Jiri

Re: 1441 No "OnStartup" event in MM4

by ZvezdanD » Sat Oct 08, 2011 5:06 pm

Peke wrote: it is not regular Event you can hook on like with OnPlay.

I explained this in http://www.ventismedia.com/mantis/view.php?id=8482

NOTE: OnShutdown event also do not belong there. Documentation should be updated/fixed.
Well, strictly speaking, you are right that OnStartup is not regular event since it cannot be registered with the Application object, but it should be mentioned there anyway. How do you expect that scripters learn for that event handler if you don't mention it in wiki?

OnShutdown event should belong there for sure since it could be registered as e.g. OnPlay, for example:
Script.RegisterEvent SDB, "OnShutdown", "ClearIniSection"

Re: 1441 No "OnStartup" event in MM4

by Peke » Sat Oct 08, 2011 3:08 pm

It was error in documentation That needs to be fixed as like you pointed Zvezdan it works as it was always worked eg. executed on Auto-Script startup. it is not regular Event you can hook on like with OnPlay.

I explained this in http://www.ventismedia.com/mantis/view.php?id=8482

NOTE: OnShutdown event also do not belong there. Documentation should be updated/fixed.

Re: 1441 No "OnStartup" event in MM4

by ZvezdanD » Sat Oct 08, 2011 11:53 am

Ludek wrote:So what is wrong here?
Please read my previous post again. That are my words exactly - there is nothing wrong there, OnStartup works fine in MM4 as it was before. However, wrong is jiri who removed a description of that event from wiki claiming that it has never existed.

Re: 1441 No "OnStartup" event in MM4

by markstuartwalker » Sat Oct 08, 2011 11:02 am

OK, so everyone except Jiri seems to think that the Sub OnStartup() gets called in both MM3 and MM4

... and I've been back to my original test to find that it works fine. Doh!

So, are we just looking at a documentation problem?

Re: 1441 No "OnStartup" event in MM4

by Ludek » Sat Oct 08, 2011 8:46 am

Zvezdan, this works correctly for me with the latest build:

Code: Select all

Option Explicit

Dim UI  : Set UI = SDB.UI

Sub OnStartUp()
    Dim mnuTest

    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = SDB.Tools.RemapASCII("BLA BLA")
    mnuTest.OnClickFunc = "Test1"
    mnuTest.UseScript = Script.ScriptPath
End Sub
The "BLA BLA" is correctly added to Edit menu.

So what is wrong here?

Re: 1441 No "OnStartup" event in MM4

by ZvezdanD » Sat Oct 08, 2011 2:27 am

I don't understand what you are talking about. How is that that this event hasn't ever existed? All my auto-scripts has OnStartup event handler which is executed on every start-up of the program - MM2, MM3 as well as MM4 (tried with many versions, even the latest build 1442). Actually, none of my auto-scripts could be used without that event since I am setting the menu items for the script's options and other initialization code during the start-up.

Re: 1441 No "OnStartup" event in MM4

by jiri » Fri Oct 07, 2011 3:03 am

It was actually an error in documentation, this event hasn't ever existed.

If you need to do anything on startup, you probably could do so when the script is first called?

Jiri

No "OnStartup" event in MM4 [#8482]

by markstuartwalker » Thu Oct 06, 2011 4:57 pm

This has been removed in MM4. Why?

http://www.mediamonkey.com/wiki/index.p ... ts_members

I would like Clear Now Playing to work but it seems to need this even to operate. (http://www.mediamonkey.com/forum/viewto ... 35#p313935)

Top