The compression is based on the removal of spaces between words.To keep the sentence parts separated, an alternating upper and lower case is assigned. If you think it is possible and useful to use the script in html5 for SMS, let me know then, pls. I use the script sometimes for composing SMS online.
Example of compression
"Worda wordb wordc WordD, worde. wordF" converts to "WORDAwordbWORDCwordd,WORDE.wordf"
Download page link
How to use
copy the text that you want compress
click on the program button or press "space" or "enter". If the color of the button changes, the converted text is then at the clipboard.
COMPRESSOR SCRIPT
//This script compresses a message without a decompressor needed to reed it.
//It alternates uppercase and lowercase and removes the spaces.
//Multiple lines, numbers and unextended ASCII code are supported.
//____________________________________________________________________________
//'³²²²³' is the reserved mark for this script.
//Treat undefined variables as '0' and use them only in this script
var a,hyperword,txt,txtp,maxi,compressed,stringcount;
//Exit script if there is no text on the clipboard or else assign the text from clipboard to 'txt'.
if clipboard_has_text()=false then exit else txt=clipboard_get_text();
//set the amount of sections of 'txt' to 'maxi'
maxi=string_count(' ',txt)+1;
//count up with 'stringcount' to the amount 'maxi' to treat 'txt' and text part 'txtp'
for (stringcount=1;stringcount<=maxi;stringcount+=1)
{
//mark the first space with mark '³²²²³' (because 'substr' of string_pos(substr,str) is always furthest)!
txt=string_replace(txt,' ','³²²²³')
//if there is no mark, then 'txtp' is assigned to the end else up to end mark
if string_pos('³²²²³',txt)=0 then
txtp=string_copy(txt,1,string_length(txt))else
txtp=string_copy(txt,1,string_pos('³²²²³',txt)+4);
//check if first text part 'txtp' is already compressed and length of 'txtp' is larger than 35
if (stringcount=1 and string_length(txtp)>=35)
then {
//check if last character of long first part is lowercase. If so, switch 'a' is 1. Set 'hyperword' to 'txtp'
if string_char_at(txtp,string_length(txtp)-5)=string_lower(string_char_at(txtp,string_length(txtp)-5)) then a=1;hyperword=txtp;}
else{
//if switch 'a' is on
if a=1 then
{//start odd 'stringcount':hyperword in 'lowercase', else 'hyperword' in uppercase
if floor(stringcount/2)<>(stringcount/2) then
hyperword=string_lower(txtp)else
hyperword=string_upper(txtp);
}
else
//start even 'stringcount':hyperword in 'lowercase', else 'hyperword' in uppercase
{if floor(stringcount/2)=(stringcount/2) then
//
hyperword=string_lower(txtp)else
hyperword=string_upper(txtp);
}}
//remove hyperword (+ mark eventually) of txt
txt=string_delete(txt,1,string_length(hyperword));
//remove mark of txt if aviable
hyperword=string_replace(hyperword,'³²²²³','');
//build up 'compressed' with the hyperword
compressed=string_insert(hyperword,compressed,string_length(compressed)+1);
};
//export string 'compressed'
clipboard_set_text(compressed);
//change image index if the conversion is successful.
if image_index=0 then {image_index=1;exit} else image_index=0;
Edited by rogonow, 06 January 2012 - 06:23 PM.











