• 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: Parents/Child Scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parents/Child Scripts


  • Subject: Re: Parents/Child Scripts
  • From: has <email@hidden>
  • Date: Tue, 14 May 2002 02:56:57 +0100

Paul Skinner

>> The only time you can wrap or replace
>> an osax call with 100% reliability is when that osax call contains no
>> optional parameters, eg:
>>
>
>Au contraire mon ami. Opps, I mean Bollocks!
>
>on display dialog (parameters)
[...]
>end display dialog

Try:

display dialog "African or European Swallow?" buttons {"YES", "NO"}

You'll get a dialog saying "African or European Swallow?" all right, but it
will display only an "OK" button. Sorry, but the "record as optional
parameters" doesn't cut it here: you still end up knackering the existing
display dialog functionality.

Here's another problem example:

on log x
tell application "Smile" to log x
end log

So far, so cool. Except... what happens when the user uses 'log' on its
own, without any argument (it is optional, after all). As I said before,
there is no good solution to this problem. :(


>display dialog ({message:"Hello World", buttonlist:{"Don't push me",
>"Push me"}, defaultButton:"Don't push me", IconSpec:1})

Users already expect a certain interface from "display dialog". By changing
that interface all you're really doing is confounding their expectations
and causing confusion. Instead, it'd be better to name your handler
differently, e.g. "displayDialog()".

Now folks will go read your documentation and learn how to use this new
handler in its own right. Both handlers will [continue to] function as-per
user expectation, and so the world is happy again. (Or as happy as it can
be without optional flippin' params...:p)


Sorry, Paul, but "au contraire" back at you. (Don't argue now, else I shall
have to say "Nee!" at you.)


has (no ordinary rabbit;)

p.s. OT aside: your script also reminds me why I never use single,
real-English words as identifiers. Some osax I've got installed decided
that the term "message" belonged to it and "helpfully" turned it into
keyword for me, resulting in a runtime error. This is why, in the absence
of anything better, I'll prefix any such names with "the" - i.e.
"theMessage", "theParameters". With all these osaxen around, the world
isn't a safe place for uncompiled scripts with single-word variable names
in them...:p

--
http://www.barple.connectfree.co.uk/ -- The Little Page of Beta AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Parents/Child Scripts
      • From: Paul Skinner <email@hidden>
    • Re: Parents/Child Scripts
      • From: Andy Wylie <email@hidden>
  • Prev by Date: Re: 'Concatenate' from a list
  • Next by Date: Re: Parents/Child Scripts
  • Previous by thread: Re: Parents/Child Scripts
  • Next by thread: Re: Parents/Child Scripts
  • Index(es):
    • Date
    • Thread