• 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
Re: Puzzling display dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Puzzling display dialog


  • Subject: Re: Puzzling display dialog
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 21 Feb 2007 17:17:03 -0600

The scripting that now works is ...

tell me to display dialog the result with title dTitle buttons {"Cancel", "Automatic", "Manual"} ¬
default button 3 cancel button 1
if (button returned of the result) = "Automatic" then
... unicode text --> result
else
... unicode text --> result
end if
tell application "Finder" to set comment of (alias file "x" of someAlias) to the result


At first the problem seemed to be with the 'display dialog ... '. When I clicked "Automatic", I got the "The cancel button cannot ... " error. But then I tried this ...

tell me to display dialog the result with title dTitle buttons {"Cancel", "Automatic", "Manual"} ¬
default button 3 cancel button 1
if (button returned of the result) = "Automatic" then
... integer & tab & text --> result
else
... integer & tab & text --> result
end if
tell me to display dialog "1" -- as a debug break
tell application "Finder" to set comment of (alias file "x" of someAlias) to the result


The first 'display dialog ... ' worked perfectly, then the second worked perfectly until I clicked OK, whereupon I got the "The cancel button cannot ... " error.

This clearly points to the problem being in the line 'tell application "Finder" to ...', and that is where I fixed the problem.

That error is specifically from "display alert", and occurs when you specify both the cancel button and the default button to be the same thing.

The error is telling me that "The cancel button cannot be the same as the default button.", but in fact this error message is NOT true. The cancel and default buttons ARE different. Changing 'text' to 'unicode text' fixed the problem. Is there a leak dribbling onto something it shouldn't?



On Feb 21, 2007, at 4:19 PM, Christopher Nebel wrote:

On Feb 18, 2007, at 4:31 PM, Luther Fuller wrote:

This is a very puzzling error. My script contains the line ...

tell me to display dialog the result with title dTitle buttons {"Cancel", "Automatic", "Manual"} default button 3

The dialog displays properly, but when I click "Manual" or "Automatic", I get the error message ...

	"The cancel button cannot be the same as the default button."

After many recompiles, (I'll spare you the details), I finally found the cause!

AFTER the dialog was the line ...

tell application "Finder"
set comment of (alias file "x" of someAlias) to anInteger & tab & someText
end tell


I changed this (finally!) to ...

( anInteger as Unicode text) & tab & someText as unicode text
tell application "Finder" to set comment of (alias file "x" of someAlias) to the result


Now it works, but that's a strange error returned by the Finder.
Has anyone seen this before? And is there more to be known about this?

I think you're confusing the source of the error with a slightly earlier command. Also, be aware that if you tell an application, such as Finder, to do a scripting addition command and the command throws an error, it will be reported as coming from the application. That doesn't make it the application's fault.


That error is specifically from "display alert", and occurs when you specify both the cancel button and the default button to be the same thing.


--Chris Nebel AppleScript Engineering

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


This email sent to email@hidden

_______________________________________________ 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/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Puzzling display dialog
      • From: Michelle Steiner <email@hidden>
References: 
 >Puzzling display dialog (From: Luther Fuller <email@hidden>)
 >Re: Puzzling display dialog (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: query if application is open
  • Next by Date: Re: Accesing menu bar items.
  • Previous by thread: Re: Puzzling display dialog
  • Next by thread: Re: Puzzling display dialog
  • Index(es):
    • Date
    • Thread