• 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: default arguments/parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: default arguments/parameters


  • Subject: re: default arguments/parameters
  • From: "Rua Haszard Morris" <email@hidden>
  • Date: Fri, 10 Oct 2003 09:16:49 +1000

Thanks all for the helpful/interesting responses.

I guess after all this is a scripting language...!

If anyone's keen to hype their particular convention (as Arthur did so
below, cheers), it might benefit the community?

In the meantime I'm going to go with the most common convention of all -
assume that the caller knows how to call the func correctly!!!

Cheers,
Rua.

From: "Arthur J. Knapp" <email@hidden>
To: <email@hidden>

> From: "Rua Haszard Morris" <email@hidden>
> Subject: default arguments/parameters
> Date: Thu, 9 Oct 2003 14:17:51 +1000

> Is there a way to define a handler to take default positional
> parameters?

No, the language does not have this functionality. It also doesn't
allow optional parameters... a far more serious deficit.


> to displayplaindialog(optional texttoshow = "default text")
> display dialog texttoshow

on DisplayDialog(vSettings)

set r to {_prompt:"Hello World", _field:"", _push:{"OK"}, _default:"OK"}

if (vSettings's class = string) then
set r's _prompt to vSettings
else if (vSettings's class = record) then
set r to vSettings & r
end if

display dialog (r's _prompt) default answer (r's _field) buttons (r's
_push) default button (r's _default)

end DisplayDialog

DisplayDialog(0) --> use all defaults
DisplayDialog(false) --> use all defaults
DisplayDialog(missing value) --> use all defaults

DisplayDialog("Admiral Novia") --> set prompt

DisplayDialog({_push:{"Yes", "No"}, _default:"Yes"}) --> set buttons


> I get the feeling these things can be done but there is not
> standard predefined way to do em, and there's no conventional way
> either (everyone does it their own way)..

I certainly always do things my own way...! :)

Apple provided few means of creating handlers with "intelligent"
parameters. If your creating script libraries for others to use,
there are no "standard predefined" conventions, just document how
your doing things as well as possible.


{ Arthur Knapp, of <http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m

"Safe the Nature" --> political graffiti in Prague
}

Rua Haszard Morris
Software Engineer & Research Assistant
MARCS Auditory Laboratories
http://www.uws.edu.au/marcs
Ph +61 2 97726723 Fax +61 2 97726326
_______________________________________________
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.

  • Prev by Date: Finding out text under mouse
  • Next by Date: Re: Finding RGB Images in QXP via script
  • Previous by thread: Re: default arguments/parameters
  • Next by thread: file type question
  • Index(es):
    • Date
    • Thread