New handling of script instances

发表回复

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

BBCode 允许
[img] 允许
[url] 允许
表情 允许

主题浏览
   

展开视图 主题浏览: New handling of script instances

Re: New handling of script instances

jiri » 周二 1月 13, 2009 4:20 pm

Only the global variables, SDB.Objects persists whole MM session.

Jiri

Re: New handling of script instances

Teknojnky » 周二 1月 13, 2009 4:12 pm

From wiki @ http://www.mediamonkey.com/wiki/index.p ... ol::Reload
Note that by calling this method you lose all global variables of the reloaded script, their content can't be preserved. On the other hand, all registered events are preserved.
Does this include related sdb.objects or just global variables within the script(s)?

Re: New handling of script instances

Teknojnky » 周二 1月 13, 2009 4:07 pm

excellent news, thanks Jiri

Re: New handling of script instances

Bex » 周二 1月 13, 2009 4:03 pm

Great!
Thank you, Jiri! :D

Re: New handling of script instances

jiri » 周二 1月 13, 2009 4:00 pm

There will be SDBScriptControl::Reload method introduced in the next build. It should resolve your problems, you can either create a toolbar icon and force script reload whenever needed, or can call it in a timer, so that the script is periodically refreshed, or whatever else you might like.

Jiri

Re: New handling of script instances

Teknojnky » 周一 1月 12, 2009 10:04 pm

In my case, Still restarts due to script/programtic errors.

Re: New handling of script instances

Bex » 周一 1月 12, 2009 9:49 pm

I don't see any need to notify the user at all.
Well, since setting a script in devmode would prevent it from being ran as the latest script handling change has intended. it would make it a candidate to cause memory leaks etc.. Informing the user is therefore necessary. Otherwise is the latest script handling change possible to circumvent thus making it not to fix was it was intended to fix.
But if the dev's feel such a restriction is necessary, then perhaps enable only MM debug releases (but still no pop-up notifications)
Good idea. Another one could be to create strict developing version of MM. Which treats script the old way and has no pop-ups! :D
What if you had or were developing multiple scripts, can you imagine getting a bunch of pop up warnings every time you started MM? I would go insane and simply stop using/developing scripts.
The suggested change would almost eliminate the need for a restart so I really don't see this as a big problem!

Re: New handling of script instances

Teknojnky » 周一 1月 12, 2009 9:28 pm

Bex 写了:1. It would only pop-up once per restart. Something like:

代码: 全选

Script "Vbs filename goes here" is in Developing Mode. If that is unexpected, Do Not use the script and please notify the script author!
But is there another way to alert the normal user that he is using a script that is in developing mode, if the developer misses to change the property?

2. Yes that was what I meant. E.g the developer just adds SDB.DevelopingMode=True in the top of the script to make it behave differently.
I don't see any need to notify the user at all.

But if the dev's feel such a restriction is necessary, then perhaps enable only MM debug releases (but still no pop-up notifications).

What if you had or were developing multiple scripts, can you imagine getting a bunch of pop up warnings every time you started MM? I would go insane and simply stop using/developing scripts.

Re: New handling of script instances

Bex » 周一 1月 12, 2009 9:12 pm

1. It would only pop-up once per restart. Something like:

代码: 全选

Script "Vbs filename goes here" is in Developing Mode. If that is unexpected, Do Not use the script and please notify the script author!
But is there another way to alert the normal user that he is using a script that is in developing mode, if the developer misses to change the property?

2. Yes that was what I meant. E.g the developer just adds SDB.DevelopingMode=True in the top of the script to make it behave differently.

Re: New handling of script instances

Teknojnky » 周一 1月 12, 2009 9:00 pm

A DevMode that would disable all script caching would be great.

I have to veto the warning pop up tho, pop up dialogs are just extremely annoying and that would almost as bad as having to constantly re-start MM in the first place.

Ideally the devmode property should be on a per script basis, but a global devmode would be sufficient as well.

Re: New handling of script instances

Bex » 周一 1月 12, 2009 8:47 pm

What about to implement a new "property" SDB.DevelopingMode(True/False) which sets the script to a Developing Mode. In that mode all Subs/Functions should be reread from the script file when executed thus making a restart unnecessary.
If SDB.DevelopingMode=True then some sorts of warning should pop up on starting the script which would prevent users from using it if a developer forgets to set SDB.DevelopingMode=False.

Is that possible to implement?

Re: New handling of script instances

Teknojnky » 周五 1月 09, 2009 2:02 pm

I was doing some testing and yea, this new behavior is very difficult for script development and testing changes.

Re: New handling of script instances

Bex » 周日 1月 04, 2009 5:05 pm

Yes, to implement something which solves this would be very nice since developing scripts is now really time consuming.

Re: New handling of script instances

Big_Berny » 周日 1月 04, 2009 4:58 pm

Yes, would be very nice if this could be changed in the next build again. I just installed 1207 and wanted to work on optionsheets which is a real pain like this... Downgraded to 1204 for now.

Re: New handling of script instances

jiri » 周四 1月 01, 2009 6:24 pm

It would only cause that all global variable of the script would be lost (i.e. re-initialized). However, as I think about it, it probably isn't the best idea, it wouldn't help that much and possibly rather cause problems. So, let's rather leave it as is, unless we find some better solution...

Jiri

页首