Applescript Messanger

I have made a messaging application! :smiley:

It runs off of PHP scripts that you can find right here. If a person does not have a mac, they can go to the URL and the “index” has a small field for message and name, and below that is the messages.
The script is below.

property username : missing value
property website : missing value

on run
	asklogin(false)
	repeat
		set messages to do shell script "curl " & website & "veiw?mode=get |textutil -format html -convert txt -stdin -stdout"
		if messages is "Messages:" then set messages to "No messages."
		repeat
			if messages contains "404 Not Found" then
				set website to missing value
				asklogin(true)
				set messages to do shell script "curl " & website & "veiw?mode=get |textutil -format html -convert txt -stdin -stdout"
			else
				exit repeat
			end if
		end repeat
		set message to display dialog messages & return & return & "---" & return & return & "What message do you want to send?" default answer "Hello." buttons {"Change Settings/Quit", "Send"} default button "Send" giving up after 30
		if not gave up of message then
			if button returned of message is "Change Settings/Quit" then
				display dialog "What do you want to do?" buttons {"Clear Chat", "Reset Settings", "Quit"} default button "Quit" cancel button "Quit"
				if button returned of result is "Reset Settings" then
					set {website, username} to {missing value, missing value}
					asklogin(false)
				else if button returned of result is "Clear Chat" then
					set thepass to text returned of (display dialog "What is the password?" default answer "" default button "OK")
					do shell script "curl -d \"pass=" & thepass & "\" " & website & "clear.php"
				end if
			else
				set message to text returned of message
				do shell script "curl -d \"message=" & message & "&name=" & username & "\" " & website & "post.php?web=applescript"
			end if
		end if
	end repeat
end run
on asklogin(o)
	if o then
		if website is missing value then set website to text returned of (display dialog "What website do you want to chat on?\n\t(this site has to have the appropriate files) AN ERROR HAS OCCURED" default answer "" default button 2)
		if username is missing value then set username to text returned of (display dialog "What do you want your username to be?" default answer "" buttons {"OK"} default button 1)
	else
		if website is missing value then set website to text returned of (display dialog "What website do you want to chat on?\n\t(this site has to have the appropriate files)" default answer "" default button 2)
		if username is missing value then set username to text returned of (display dialog "What do you want your username to be?" default answer "" buttons {"OK"} default button 1)
	end if
	if website does not end with "/" then set website to website & "/"
end asklogin

NOTE: To clear the chat, navigate to the “chat.php” page and insert “pass123” (unless changed in the file) and it should do it, or you can do it inside of the messaging application script…

If there is any problems, post them onto this post. I will be updating these scripts, so if there is a problem, you should re-download everything and then try again.