Shoutbox

Rename a script upon updating it - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Rename a script upon updating it (/showthread.php?tid=80694)

Rename a script upon updating it by mynetx on 01-04-2008 at 06:54 PM

Current situation:
the user has installed a script in its, let's say, "SomeName", v1.0.
That script has an auto-update function downloading a plsc from a web-stored xml update file.
For some reason, the script author wants to change the script name in the new version. Normally, the new script would import and run next to the old, because the name is different, so no overwrite would take place.

Question:
How to implement a replacement of the old script that had a different name than the new?

Surely, the new script could check for the old's existence and set it to registry>Enabled=0, wait for the next messenger reload and then kill all its data. But, is there a "clean", yet automatic, solution? (Firefox's extensions use guids... as idea only.)


RE: Rename a script upon updating it by Matti on 01-04-2008 at 07:03 PM

Simple, in fact. :)

There's a secret member of the ScriptInfo element. It's called "InstallDir" and allows the developer to set a different installation folder.

For example, if you want to call your script "Hello World!" but you want to install it in "HelloWorld", you could use this for your ScriptInfo.xml file:

code:
<?xml version="1.0" encoding="Unicode"?>
<ScriptInfo xmlns="urn:msgplus:scripts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <Information>
      <Name>Hello World!</Name>
      <Description>This script greets the world!</Description>
      <AboutUrl>http://www.MySite.com/</AboutUrl>
      <Version>0.1.001</Version>
      <Author>Me!</Author>
   </Information>
   <InstallDir>HelloWorld</InstallDir>

</ScriptInfo>
This has been used by Screenshot Sender, it installs to "Screenshot Sender 4" but the name is just "Screenshot Sender".

However, if you don't like the name of the installation directory of your old script, this won't have much use...
RE: Rename a script upon updating it by mynetx on 01-04-2008 at 07:08 PM

Thanks, mattike. That's indeed a very good yet simple solution. And: the old name is just somewhat outdated, but I can keep it as folder name.