• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange Errors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange Errors


  • Subject: Strange Errors
  • From: Daniel Chavez <email@hidden>
  • Date: Mon, 10 Aug 2015 11:41:02 -0400

Good morning/afternoon,
I’m trying to create a multi-dialog with the ability to ping an IP or domain name, or retrieve an IP.
I have an existing dialog as
display alert "What would you like to do" buttons {"RetrieveYourIP", "PingIPOrDomainName", "Quit"} cancel button "Quit" with title "Select a network option"
set the button_pressed to the button returned of the result
#Buttons
if the button_pressed is "RetrieveYourIP" then
say "Retrieving Your IP address, this may take a moment." without waiting until completion
WanIP()
display alert "Your IP Address is" & WanIP() & "And has been copied to your clipboard."
set the clipboard to WanIP()
on WanIP()
set WIP to missing value
set siteList to {"http://checkip.dyndns.org/", "http://whatismyip.com", "http://www.whatismyipaddress.com", "http://ipid.shat.net/", "http://www.edpsciences.comhtbin/ipaddress", "http://www.showmyip.com/"}
repeat with thissite in siteList
try
set WIP to item 1 of paragraphs of (do shell script "curl " & thissite & " | tr -cs '[0-9\\.]' '\\012' | awk -F'.' 'NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && $4<256 && !/\\.\\./'")
if WIP is not missing value then exit repeat
end try
end repeat
return WIP
end WanIP
else
if the button_pressed is "PingIPOrDomainName" then
set IP_address to ""
set dialog_1 to display dialog "Enter IP Address:" default answer "" with title "Ping IP Address" buttons {"OK"} default button 1
set the IP_address to the text returned of dialog_1
try
do shell script ("ping -c 2 " & IP_address)
display dialog "Host is up" buttons {"OK"} default button 1 with title "Host Status"
on error
display dialog "Host unreachable" buttons {"OK"} default button 1 with title "Host Status"
end try
endif
endif
endif
Expected “given”, “with”, “without”, other parameter name, etc. but found “””.
The entire code is
display alert "What would you like to do" buttons {"RetrieveYourIP", "PingIPOrDomainName", "Quit"} cancel button "Quit" with title "Select a network option"
set the button_pressed to the button returned of the result
#Buttons
if the button_pressed is "RetrieveYourIP" then
say "Retrieving Your IP address, this may take a moment." without waiting until completion
WanIP()
display alert "Your IP Address is" & WanIP() & "And has been copied to your clipboard."
set the clipboard to WanIP()
on WanIP()
set WIP to missing value
set siteList to {"http://checkip.dyndns.org/", "http://whatismyip.com", "http://www.whatismyipaddress.com", "http://ipid.shat.net/", "http://www.edpsciences.comhtbin/ipaddress", "http://www.showmyip.com/"}
repeat with thissite in siteList
try
set WIP to item 1 of paragraphs of (do shell script "curl " & thissite & " | tr -cs '[0-9\\.]' '\\012' | awk -F'.' 'NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && $4<256 && !/\\.\\./'")
if WIP is not missing value then exit repeat
end try
end repeat
return WIP
end WanIP
else
if the button_pressed is "PingIPOrDomainName" then
set IP_address to ""
set dialog_1 to display dialog "Enter IP Address:" default answer "" with title "Ping IP Address" buttons {"OK"} default button 1
set the IP_address to the text returned of dialog_1
try
do shell script ("ping -c 2 " & IP_address)
display dialog "Host is up" buttons {"OK"} default button 1 with title "Host Status"
on error
display dialog "Host unreachable" buttons {"OK"} default button 1 with title "Host Status"
end try
else
display alert "Thank you for using this application. If you liked using this application, please consider donating by visiting the application website and clicking on donate. Any amount donated would be greatly appreciated.
Would you like to file a bug report? Visit the main application website?Or quit?" buttons {"FileBugReport", "VisitApplicationWebSite", "Quit"} cancel button "Quit"
set the button_pressed to the button returned of the result
#Buttons
if the button_pressed is "VisitApplicationWebSite" then
set VisitApplicationWebSite to "http://firestar-hosting.com/mac"
open location VisitApplicationWebSite
else
if the button_pressed is "FileBugReport" then
set FileBugReport to "http://firestar-hosting.com/mac/bugs"
open location FileBugReport
end if
end if
end if

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Strange Errors
      • From: "Stockly, Ed" <email@hidden>
    • Re: Strange Errors
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Do Shell Script
  • Next by Date: Re: Do Shell Script
  • Previous by thread: Re: Do Shell Script
  • Next by thread: Re: Strange Errors
  • Index(es):
    • Date
    • Thread