Shoutbox

Script Getting Mostly Deleted On Importation - 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: Script Getting Mostly Deleted On Importation (/showthread.php?tid=64159)

Script Getting Mostly Deleted On Importation by DarthCrap on 07-28-2006 at 05:03 PM

I have created a script, and packaged it into a plsc file. But when i import it the script only contains one character (the first character in the js file - forwards slash). The original script file is 9068 bytes. Does anyone know why this is happening?


RE: Script Getting Mostly Deleted On Importation by absorbation on 07-28-2006 at 05:12 PM

Can you post the source code please :)


RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-28-2006 at 05:20 PM

kk

FILE 1 : JS FILE


RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-28-2006 at 05:20 PM

FILE 2 : ScriptInfo.xml


RE: Script Getting Mostly Deleted On Importation by mickael9 on 07-28-2006 at 05:24 PM

It's the encoding of the js file. It should be AINSI

(I've converted it and it works fine)


RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-28-2006 at 05:30 PM

what was the original encoding of the js file? EDIT : it was unicode


RE: Script Getting Mostly Deleted On Importation by Patchou on 07-28-2006 at 10:17 PM

Actually no, every JScript file distributed in scripts is supposed to be Unicode as it will load faster.


RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-29-2006 at 10:53 AM

Any ideas why it was getting mostly deleted in unicode and not in ansi then? :p


RE: Script Getting Mostly Deleted On Importation by John Anderton on 07-29-2006 at 10:59 AM

quote:
Originally posted by absorbation

I have created a script, and packaged it into a plsc file. But when i import it the script only contains one character (the first character in the js file - forwards slash). The original script file is 9068 bytes. Does anyone know why this is happening?

You could have downloaded the plsc, renamed the extention to zip and extracted it since plsc's are basically .zips :P
RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-29-2006 at 11:03 AM

@john anderton
yeh, but its my script, and for the ease of ppl hu r to lazy to do that... (which is mostly everyone apart from actual script programmers)

@patchou
The next script i did last nite works better in asci aswell :p


RE: Script Getting Mostly Deleted On Importation by CookieRevised on 07-29-2006 at 04:19 PM

To set some things strait:

quote:
Originally posted by absorbation
Can you post the source code please :)
download the script pack he posted. No need for anything else ;)

quote:
Originally posted by John Anderton
You could have downloaded the plsc, renamed the extention to zip and extracted it since plsc's are basically .zips :P
That wouldn't have solved his issue as the error is in how the JS file is saved. Even if manually added Plus! will not be able to read the JS file properly.

If you meant he could have attached the JS file directly to his post without making a script pack: helpers could easly extract the files for themselfs (at least they should know how). Also if he did that, he would still have a problem with creating script packs since the XML file wasn't unicode either.

;)

quote:
Originally posted by mickael9
It's the encoding of the js file. It should be AINSI
(I've converted it and it works fine)
As Patchou said, the encoding can perfectly be unicode. In fact it would be a bit better actually. Though the encoding should not matter, but only if the file is encoded properly in ansi or unicode (read further for more)...

-------------------------------------------------------------------------------------

Now for the real deal:

quote:
Originally posted by DarthCrap
what was the original encoding of the js file? EDIT : it was unicode
Actually it wasn't!

quote:
Originally posted by DarthCrap
Any ideas why it was getting mostly deleted in unicode and not in ansi then? :p
Yes... What did you use to create those JScript files?

Because the file was NOT properly written as an unicode file. The characters themselfs were written as unicode but the file itself is missing the special 2 byte unicode header (known as the BOF header) which is mandatory for every proper unicode file.

Since that special header is not present in the file, Plus! does not reconize the file as an unicode file and will simply read it as an ansi text file (since text files do not have that special 2 byte BOF header).

And because Plus! reads it as a normal ansi file, it stops reading after the second byte because that byte (0x00) isn't a proper ascii character and thus only "/" is shown (which was the first character in the file).

In other words, use a proper editor to save your files with (eg: notepad) and you wont have chopped of scripts...


Secondly the error you got that the script couldn't be started is because the file ScriptInfo.xml must be saved in the same encoding as defined in the XML header and this should actually be unicode.

;)
RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-29-2006 at 05:03 PM

Nice post CookieRevised :p very good explanation

quote:
Originally posted by CookieRevised

Yes... What did you use to create those JScript files?

Because the file was NOT properly written as an unicode file. The characters themselfs were written as unicode but the file itself is missing the special 2 byte unicode header (known as the BOF header) which is mandatory for every proper unicode file.

Since that special header is not present in the file, Plus! does not reconize the file as an unicode file and will simply read it as an ansi text file (since text files do not have that special 2 byte BOF header).

And because Plus! reads it as a normal ansi file, it stops reading after the second byte because that byte (0x00) isn't a proper ascii character and thus only "/" is shown (which was the first character in the file).

In other words, use a proper editor to save your files with (eg: notepad) and you wont have chopped of scripts...


All i did was copy the file as it was from C:\Program Files\Messenger Plus! Live\Scripts\MultipleToaster directory into a folder i created in My Documents, then I packaged it.....

quote:
Originally posted by cookierevised

Secondly the error you got that the script couldn't be started is because the file ScriptInfo.xml must be saved in unicode (it can't be ansi!).

Ok.....
Since starting this thread, i have made another script, which adds a random gradient to text (by using [c=...]text[/c]) tags...
The ScriptInfo.xml file is written in ANSI, and so for that matter is the RandomGradient.js
I have sent the RandomGradient.plsc package to two of my m8s, who have installed it successfully, and even used it in conversations with me :p
RE: Script Getting Mostly Deleted On Importation by CookieRevised on 07-29-2006 at 05:24 PM

quote:
Originally posted by DarthCrap
All i did was copy the file as it was from C:\Program Files\Messenger Plus! Live\Scripts\MultipleToaster directory into a folder i created in My Documents, then I packaged it.....
Plus! will always create proper unicode files (thus with a BOF header). So something else must have changed the file.

quote:
Originally posted by DarthCrap
The ScriptInfo.xml file is written in ANSI, and so for that matter is the RandomGradient.js
I have sent the RandomGradient.plsc package to two of my m8s, who have installed it successfully, and even used it in conversations with me (Smilie)
That shouldn't be possible if you used the proper format for ScriptInfo.xml which should be unicode and thus the XML header of ScriptInfo.xml must be:
<?xml version="1.0" encoding="UTF-16"?>

not
<?xml version="1.0"?>

It will work atm (as long as your XML header reflects the way you saved the file), but it may also possible that in future updates it will not work anymore. Make it a habit to save in unicode.
RE: RE: Script Getting Mostly Deleted On Importation by DarthCrap on 07-29-2006 at 05:26 PM

quote:
Originally posted by CookieRevised
quote:
Originally posted by DarthCrap
All i did was copy the file as it was from C:\Program Files\Messenger Plus! Live\Scripts\MultipleToaster directory into a folder i created in My Documents, then I packaged it.....
Plus! will always create proper unicode files (thus with a BOF header). So something else must have changed the file.

quote:
Originally posted by DarthCrap
The ScriptInfo.xml file is written in ANSI, and so for that matter is the RandomGradient.js
I have sent the RandomGradient.plsc package to two of my m8s, who have installed it successfully, and even used it in conversations with me (Smilie)
That shouldn't be possible at all either as Plus! will not read ansi xml files.


OK, well the plsc of the randomgradient is attached, just to prove my point :p