Hi everyone, I have this script I’m still tweaking. It is working to this point. It asks for name and email address, then uses that info to send an email if my IP changed. I want to save the name and email address as text in the script, then run the IP checking part of the script every hour. I read about the handler, and how to run the script every hour, but I don’t want user input after the initial input. I would like the IP checking part of the script to take over and keep checking. I thought about having the text input script call the IP checker script that way I could just run the checker separate, but can I save text from one script to another, or can I save the text input to a script at all? Thanks
display dialog “Enter Your Name” default answer “”
set yourName to (text returned of result)
display dialog "Thank You " & yourName buttons “” giving up after 1
repeat 3 times
display dialog “Enter Email Address” default answer “”
set emailAddress to (text returned of result)
if emailAddress contains “@” then exit repeat
if emailAddress does not contain “@” then display dialog “Invalid Email Address” buttons “OK”
end repeat
if emailAddress contains “@” then display dialog “The Email Address " & emailAddress & " has been saved”
try –This is where I want the script to start running on the hour after saving name and email address below
set Current_ipAddress to do shell script "/usr/bin/curl http://checkip.dyndns.org | /usr/bin/awk ‘/: / {print $6}’ | /usr/bin/cut -f 1 -d ‘<’ "
set ipAddress to Current_ipAddress
set Old_IPAddress to (do shell script "defaults read ScriptCheckIPAddress ipAddress")
if Old_IPAddress = Current_ipAddress then
else
do shell script ("defaults write ScriptCheckIPAddress ipAddress " & ipAddress as text)
tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:"Your IP Address has changed", content:"Your Current IPAddress is: " & Current_ipAddress}
tell newMessage
make new to recipient at end of to recipients with properties {name:yourName, address:emailAddress} --[i]This is where I want to save user name and email as text[/i]
end tell
send newMessage
end tell
end if
on error
do shell script ("defaults write ScriptCheckIPAddress ipAddress " & ipAddress as text)
end try