This language and its documentation patchy and confusing!

Can somebody please help. I have used more mechanical scripting languages in the past like javascript and PHP and found them fairly logical. But AppleScript seems like it try’s to be too human with its context so it is hard to work out what words are functions, parameters and just words to help readability. When ever I find a resource that tells me the parameters of a command the parameters are written in a way that assumes I know how the syntax is meant to work.

For example… This is directly from Apple’s AppleSript website (

Now none of these are consistent… What values do these take? how do I write the syntax? The first one has the word “with” already in it so do I need to write “with” twice?

This is stupid. The documentation is so casual!

Can somebody please help me out!!!


the dictionary listings in Script Editor are more significant

choose file‚v : Choose a file on a disk or server
choose file
[with prompt text] : the prompt to be displayed in the dialog box
[of type list of text] : a list of file types or type identifiers. Only files of the specified types will be selectable.
[default location alias] : the default file location
[invisibles boolean] : Show invisible files and folders? (default is true)
[multiple selections allowed boolean] : Allow multiple items to be selected? (default is false)
[showing package contents boolean] : Show the contents of packages? (Packages will be treated as folders. Default is false.)
→ alias : the chosen file

the parameters in brackets are optional. The basic form is

choose file

with a prompt

choose file with prompt "choose a file"

with a default location

choose file with prompt "choose a file" default location (path to desktop)

without showing invisible files

choose file with prompt "choose a file" default location (path to desktop) without invisibles


Further to Stefan’s reply, the parameter keywords given are the “labels” for those parameters. Labels may consist of more than one word, so with prompt, although two words, is a single label, not the AppleScript keyword with followed by another keyword prompt. This is followed by the text value you want to give the parameter.

The three boolean parameters in Stefan’s dictionary example have the labels invisibles, multiple selections allowed, and showing package contents. When labelled parameters take boolean values, it’s normal to precede the labels with with or without to make the values true or false respectively. (Alternatively, you can type true or false after the labels and the syntax will automatically change to the with or without form when you compile.) In these cases, with and without are separate keywords. Effectually, they’re the parameters’ values.

You’ll see this if you compile this line:

choose file with prompt "choose a file" with invisibles

Unless you’ve set your Script Editor “Formatting” preferences to show all compiled script text the same colour, the first with will be the same colour as prompt because the developer of this scripting addition command used them as a two-word label. The second will be a different colour because it’s a language keyword, not part of a label.

It is confusing at first, but it does begin to make sense after a while. :slight_smile: