Need help with a compress program

Hey, I made a program that sets words in a list to smaller words to take up less RAM blocks. But when it’s decompressed, the lines down (return key) are not there anymore, I need to make a way so it can know when to add a symbol for return…I have this so far…but it does not see the return key and decompresses it without them


set the_marks to {"end", "try", "display", "considering", "set", "ignoring", "returned", "default", "count", "to", "else", "if", "contains", "word", "item", "text", "current", "date", "days", "dialog", "application", "tell", "exit", "repeat", "with", "then", "from", "not", "equal", "words", "of", "string", "delay", "ends", "answer", "as"}
set chars to {"Å“", "∑", "®", "∞", " ", "¥", "ø", "Ï€", "Ã¥", "æ", "ß", "Ω", "ç", "√", "∫", "Ëœ", "µ", "ž", "Å’", "", "Ï", "Í", "»", "∏", "Ô", "¡", "°", "Æ", "€", "˘", "§", "¢", "â„¢", "∞", "¶", "fl"}
display dialog "Welcome" buttons {"Decompress data", "Cancel", "Compress data"} default button 3 ¬
	
if "Compress data" is button returned of result then
	try
		set v to {}
		set r to {}
		set w to {}
		set n to text returned of (display dialog "Enter" default answer "")
		repeat with i from 1 to count of words in n
			if the_marks contains word i of n then
				set end of v to word i of n & "/"
			else
				set end of v to word i of n
			end if
		end repeat
		repeat with i from 1 to count of v
			set this_item1 to item i of v
			if item i of v ends with "/" then
				set this_item to item i of v
				repeat with j from 1 to 99999999
					if this_item = item j of the_marks & "/" as string then
						set end of r to item j of chars
						exit repeat
					end if
				end repeat
			else if this_item1 is not equal to item j of the_marks & "/" as string then
				set end of r to this_item1 & " "
			end if
		end repeat
		display dialog "Data is now compressed" default answer r as string
	end try
else
	set v to {}
	set r to {}
	set w to {}
	set n to text returned of (display dialog "Enter" default answer "")
	set r to n
	repeat with i from 1 to count of r
		set this_char2 to item i of r
		if chars contains item i of r then
			set this_char to item i of r
			repeat with j from 1 to 99999999
				if this_char = item j of chars then
					set end of w to item j of the_marks & " "
					exit repeat
				end if
			end repeat
		else
			set end of w to this_char2
		end if
	end repeat
	display dialog "Data is now compressed" default answer w as string
end if

open this in you’re editor and run it, compress it’s code, just copy and paste it…then decompress it and see what I mean, the returned are not there anymore. I can’t think of a way to fix this! please help :slight_smile:

Also note I am only making this because i’m kinda new to AppleScript so I wanted to see if I could do it. I also mean so it takes up less hard drive space, not RAM, hehe…
But yeah, I need to find a way so it knows when to go down to the next line (return key)