What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! Bug Reports » Debug registry key...

Debug registry key...
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Debug registry key...
quote:
Originally posted by Matti
True, but sometimes reloading the script is needed. When script files become obsolete in newer versions, you might need to remove those before the updated script is started to prevent duplicate functions definitions.
Nope though... it is not needed to restart scripts for that.

There is realy no reason why you should revert to something like your own routine to restart a script to clean up old files. That was not the reason why I showed that method to restart a script programmatically.

You should not be using it for that since there is absolute no benefit in restarting a script compared to what you could otherwise do which would have the very same effect and in a much much safer, cleaner and shorter way, especially in case of just renamed files.

Moreover, using a routine to restart the script yourself in order to update files will not always work (I'm not talking about the ScriptEnableDebug key now though). The reason for this is that you have no control what files will be started first by Plus! after you've updated. As such, it is not certain that you new file will be run before the old, to be removed, files. To make sure your old files with the old events aren't started, you need to overwrite them _before_ they have a chance to get started. Thus after your update is imported, but before the script is restarted by Plus!. And that can only be done by the use of 'empty' files:

quote:
Originally posted by Matti
The downside is that these obsolete files will still clutter your script package for all versions to come...
That's hardly a downside imho, compared to using a method which can have unpredicted results and, as shown above, which completely depends on a registry key and all the issues it causes (because now, in all your subsequent updates you also must start cleaning out the registry because of it). Not to mention that if your main script file containing the Plus! events has been renamed, the update might now have failed in Plus! 5 (because of duplicated event functions, because the old files weren't removed, because Plus! did not detect a file change, because that ScriptEnableDebug key was not properly set, etc). And who knows how that ScriptEnableDebug key is going to be used in the futur.

As explained above, you need 'empty' files anyways if you want to make sure you don't run into troubles. You can not get the same effect by restarting the script yourself.

Anyways, the user doesn't even see these 'empty' files, and your new code will not be cluttered with cleanup code,  if you use the method below:

--

Simple add this snippet in the file you want to be removed in your next update:
Javascript code:
var fso = new ActiveXObject("Scripting.FileSystemObject");
try {
    // Replace 'todelete.js' with the file name this snippet is in.
    // In other words, if you want to remove the file 'hello.js',
    // then replace 'todelete.js' with 'hello.js' and add this entire snippet in 'hello.js'
    fso.DeleteFile(MsgPlus.ScriptFilesPath + "\\todelete.js");
} catch(e) {}


In other words, in case of the Countdown Live script: copy the above snippet in 'Countdown Live.js' so that it is the only thing it contains, and replace "\\todelete.js" with "\\Countdown Live.js".

That's all, nothing more needs to be done. When you pack this in a new update, and when you install that update, 'Countdown Live.js' will be removed, without cluttering your new code with cleanup code and without the user ever knowing there were 'empty' files or files containing such cleanup code (unless he explicitly unzips the script pack).

And on top of that, because the cleanup code isn't there anymore after it has done its job, it isn't run each time the user starts Messenger or logs in or whatever....

;)

quote:
Originally posted by Matti
We could really use some sort of <RemoveFiles> block in ScriptInfo.xml for these things.
Absolutely. QFT!

This post was edited on 02-23-2011 at 02:09 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-23-2011 01:13 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Debug registry key... - by whiz on 02-20-2011 at 03:28 PM
RE: Debug registry key... - by pollolibredegrasa on 02-20-2011 at 07:25 PM
RE: Debug registry key... - by whiz on 02-22-2011 at 11:37 AM
RE: Debug registry key... - by Matti on 02-22-2011 at 12:41 PM
RE: Debug registry key... - by CookieRevised on 02-22-2011 at 03:40 PM
RE: Debug registry key... - by Matti on 02-22-2011 at 05:45 PM
RE: Debug registry key... - by Spunky on 02-22-2011 at 09:00 PM
RE: Debug registry key... - by Matti on 02-22-2011 at 11:27 PM
RE: Debug registry key... - by CookieRevised on 02-23-2011 at 01:13 AM
RE: Debug registry key... - by Matti on 02-23-2011 at 02:14 PM
RE: Debug registry key... - by CookieRevised on 02-23-2011 at 02:44 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On