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...

Pages: (2): « First [ 1 ] 2 » Last »
Debug registry key...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. Debug registry key...
Not something that important, but I'd thought I'd point it out anyway.

[Image: attachment.php?pid=1009966]

It's the only registry key there, and it comes back if I delete it, so it must still be being used by Plus! at some point...

.png File Attachment: Debug Reg Key.png (30.42 KB)
This file has been downloaded 732 time(s).
02-20-2011 03:28 PM
Profile E-Mail PM Find Quote Report
pollolibredegrasa
Full Member
***

Avatar
formerly fatfreechicken

Posts: 483
Reputation: 34
35 / Male / Flag
Joined: May 2005
RE: Debug registry key...
I've tried enabling/disabling the debug options a few times but I can't get the key to reappear. However, I know there are one or two scripts out there that will write this to key and most likely have the old path hard-coded, is it possible you have one of these? Could be worth a look, just to rule those out as a cause...
;p

[Image: chickennana.gif] Vaccy is my thin twin! [Image: chickennana.gif]
02-20-2011 07:25 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: Debug registry key...
quote:
Originally posted by pollolibredegrasa
I've tried enabling/disabling the debug options a few times but I can't get the key to reappear. However, I know there are one or two scripts out there that will write this to key and most likely have the old path hard-coded, is it possible you have one of these? Could be worth a look, just to rule those out as a cause...
You're right - looks like a few scripts seems to write to this key.  Just did a file search for the key in Notepad++...
code:
Search "ScriptEnableDebug" (15 hits in 5 files)
  C:\Program Files\Yuna Software\Messenger Plus!\WLM-Scripts\Countdown Live\Upgrade.js (3 hits)
    Line 331:     var bScriptEnableDebug = Registry_GetKeyValue(HKEY_CURRENT_USER, "Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts", "ScriptEnableDebug");
    Line 331:     var bScriptEnableDebug = Registry_GetKeyValue(HKEY_CURRENT_USER, "Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts", "ScriptEnableDebug");
    Line 338:     if((bScriptEnableDebug || bScriptShowDebugWnd) && bScriptEnabled && fso.FolderExists(sScriptPath)) {
  C:\Program Files\Yuna Software\Messenger Plus!\WLM-Scripts\Fake media\Fake media.js (1 hits)
    Line 840:         DebuggingEnabled = WshShell.RegRead("HKEY_CURRENT_USER\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"); // No inf loop because of RegRead();

  C:\Program Files\Yuna Software\Messenger Plus!\WLM-Scripts\Fake media\ReloadScript.js (4 hits)
    Line 17:         var bScriptEnableDebug = Boolean(wsh.RegRead("HKCU\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"));
    Line 17:         var bScriptEnableDebug = Boolean(wsh.RegRead("HKCU\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"));
    Line 19:         var bScriptEnableDebug = false;
    Line 34:     if ((bScriptEnableDebug || bScriptShowDebugWnd) && bScriptEnabled && fso.FolderExists(sScriptPath)) {

  C:\Program Files\Yuna Software\Messenger Plus!\WLM-Scripts\Video Converter Plus!\ReloadScript.js (4 hits)
    Line 17:         var bScriptEnableDebug = Boolean(wsh.RegRead("HKCU\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"));
    Line 17:         var bScriptEnableDebug = Boolean(wsh.RegRead("HKCU\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"));
    Line 19:         var bScriptEnableDebug = false;
    Line 34:     if ((bScriptEnableDebug || bScriptShowDebugWnd) && bScriptEnabled && fso.FolderExists(sScriptPath)) {

  C:\Program Files\Yuna Software\Messenger Plus!\WLM-Scripts\Video Converter Plus!\Video Converter Plus!.js (3 hits)
    Line 1105:             DebuggingEnabled = WshShell.RegRead("HKEY_CURRENT_USER\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"); // No inf loop because of RegRead();
    Line 3106:         DebuggingEnabled = WshShell.RegRead("HKEY_CURRENT_USER\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug"); // No inf loop because of RegRead();
    Line 3110:         WshShell.RegWrite("HKEY_CURRENT_USER\\Software\\Patchou\\Messenger Plus! Live\\GlobalSettings\\Scripts\\ScriptEnableDebug",true,"REG_DWORD");

Countdown Live, Fake media and Video Converter Plus! all seem to reference the old key at some point.
02-22-2011 11:37 AM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Debug registry key...
Most of these scripts use the ReloadScript function created by CookieRevised in order to reload the script on demand. See CookieRevised's reply to Restart script through code for the details.

This registry key value reflects the "Enable script debugging" setting and is needed to determine whether changing a script file would cause Plus! to relaod the script or not. Plus! only reloads a script when debugging is enabled or when the script debugging window is opened.

To fix this issue, these scripts would have to add a Plus! version check and use "HKEY_CURRENT_USER\Software\Yuna Software\Messenger Plus!\Windows Live Messenger\GlobalSettings\Scripts\ScriptEnableDebug" for Plus! 5 instead. However, I don't think I'd change Countdown Live just for this as it shows a dialog box when the script couldn't be reloaded automatically. I'll probably add it in a later update... :P

Still, it appears that Video Converter Plus! also writes to this value, it looks like it's trying to force debugging to be enabled. You might want to contact the creator about this so he can evaluate the consequences and decide whether an update is necessary.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-22-2011 12:41 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Debug registry key...
Note: I have updated that snippet in that post to include a version check for Plus! 4 and 5.

But yeah... All script developpers should revise all their scripts and check if hardcoded paths like this are included in their scripts and update them with a version check.

This said, I still think it is wrong for a script to reload itself or another script though. It shouldn't be needed. Not even to update (updating should be left to Plus! and its updating system).

This post was edited on 02-22-2011 at 03:42 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-22-2011 03:40 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Debug registry key...
quote:
Originally posted by CookieRevised
This said, I still think it is wrong for a script to reload itself or another script though. It shouldn't be needed. Not even to update (updating should be left to Plus! and its updating system).
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. For example, the main script file in Countdown Live 1.0 was named "Countdown Live.js" but I changed this to "Main.js" for 2.0. Therefore, I needed a way to remove this old file. You could argue that I shouldn't have changed the file name but I believe developers should have the possibility to restructure their script.

A slightly better solution could be to keep a "Countdown Live.js" file in the script package and make it completely empty. This way, the obsolete file would be replaced by this empty file and could be safely deleted without restarting the script. The downside is that these obsolete files will still clutter your script package for all versions to come...

I agree that such upgrade procedures should be handled by Plus! but as long as Plus! doesn't provide such support, we're stuck with nasty workarounds. We could really use some sort of <RemoveFiles> block in ScriptInfo.xml for these things. :P

This post was edited on 02-22-2011 at 11:28 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-22-2011 05:45 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Debug registry key...
quote:
Originally posted by Matti
A slightly better solution could be to keep a "Countdown Live.js" file in the script package and make it completely empty

Even better, an instruction in ScriptInfo.xml to remove a file in the existing script's folder as you try to import over it
<Eljay> "Problems encountered: shit blew up" :zippy:
02-22-2011 09:00 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Debug registry key...
quote:
Originally posted by Spunky
Even better, an instruction in ScriptInfo.xml to remove a file in the existing script's folder as you try to import over it
Well, yeah...
quote:
Originally posted by Matti
[...] We could really use some sort of <RemoveFiles> block in ScriptInfo.xml for these things. :P
Of course, this is just a suggestion. I'm not saying it's the best or only way to do it but that's open for discussion.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-22-2011 11:27 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
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:
js 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
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Debug registry key...
I get it, I'll pack some script files which replace the obsolete files and delete themselves when they're run. For other files such as interface definitions or images, I'll just delete them after initialization. ;)

I wrote that upgrade routine back in December 2007 and it's been left unchanged since version 2.0.003 BETA which was built in the same month. It has worked just fine for all those years but I'm glad we found a better solution now. :)

Here's the code I use for the self-destruction of obsolete files:
js code:
(function(path){
    // Try to use DeleteFile from FileSystem.js if available
    // (I prefer Windows API above ActiveX)
    var deleteFunc = typeof(DeleteFile) == 'function' ? DeleteFile : false, fso;
    // If DeleteFile exists and returns true, this block won't run
    if(!( deleteFunc && deleteFunc(path) )) {
        // Fall back on FSO
        try {
            fso = new ActiveXObject("Scripting.FileSystemObject");
            fso.DeleteFile(path);
        } catch(e) {}
    }
})(MsgPlus.ScriptFilesPath+"\\FILENAME.js");
In the new version, I'll use a minified version of this code like:
js code:
(function(p){var d=typeof(DeleteFile)=='function'?DeleteFile:0,f;if(!d||!d(p)){try{f=new ActiveXObject("Scripting.FileSystemObject");f.DeleteFile(p);}catch(e){}}})(MsgPlus.ScriptFilesPath+"\\FILENAME.js");
which is only 412 bytes long in UCS-2 LE.

My point still stands though, this really should be done by Plus!. :P



Back on topic perhaps?

The registry value being read by some scripts doesn't matter that much (although they shouldn't actually be reloading the script). Also, it appears that the latest version of Video Converter Plus! (2.60.016) doesn't write to this registry value any longer. Simply update Video Converter Plus!, remove the registry value and it won't come back. Problem solved! :)

This post was edited on 02-23-2011 at 02:44 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-23-2011 02:14 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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