• 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
Catching errors in dialog Input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Catching errors in dialog Input


  • Subject: Catching errors in dialog Input
  • From: Daniel Chavez <email@hidden>
  • Date: Thu, 29 Oct 2015 11:43:03 -0400

Hi,
I want to be able to let a user know if they've not put in a host name, that the box is empty. The catch would be, if they selected ping by accident, and they just pressed enter to try and exit, it would say something like, no host or ip detected, do you wish to continue?
If yes, it will bring them back to the ping input dialog, if not, it should go to the final application dialog.
This is what I have for ping

else if the button_pressed is "PingIPOrDomainName" then
set IP_address to ""
set dialog_1 to display dialog "Enter IP Address or domain name:" default answer "" with title "Ping IP Address or domain" 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
end if
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 exit?" buttons {"FileBugReport", "VisitApplicationWebSite", "Exit"} cancel button "Exit"
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
Thanks.
 _______________________________________________
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

  • Prev by Date: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • Next by Date: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • Previous by thread: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
  • Next by thread: El Capitan & System Preferences – Focus on Main Button Panel
  • Index(es):
    • Date
    • Thread