Name

Standard Additions

Dictionary classes

dialog reply

This record object is the return value of the display dialog scripting addition. display dialog displays a message in a modal dialog window (i.e., a window that appears in front of other windows), optionally requests the user to enter some text in an edit field, and optionally closes itself after a specified number of seconds. A record is a series of name/value pairs separated by commas and surrounded by a pair of curly braces. The return value for the following example looks like this:

{text returned:"Bruce", button returned:"OK", gave up:false}

Your return value will only include the gave up property if the display dialog command included the giving up after parameter when the command was used, as in display dialog "Tired of me yet?" giving up after 10.

set rep to (display dialog "Identify yourself please." default¬
answer "" giving up after 30)
(*
the variable rep could contain this:
{text returned:"Bruce", button returned:"OK", gave up:false}
*)

The following are dialog reply properties:

file information

This record is returned by the info for scripting addition. A pretty simple code phrase for getting file information is:

set f to (info for (choose file))

The choose file scripting addition lets the user choose a file, then returns an alias type for handling by the info for osax. Here is a look at a sample return value:

{name:"applescript.doc", creation date:date "Saturday, May 20,
2000 9:57:58 AM", modification date:date "Saturday, May 20, 2000 9:57:58 AM",
icon position:{0, 0}, visible:true, size:23877, folder:false, alias:false,
locked:false, busy status:true, file creator:"MSWD", file type:"BINA", short
version:"", long version:"", default application:alias "Macintosh HD:Microsoft
Office 98:Microsoft Word"}

name international text (read-only)

This string returns the name of the file.

size integer (read-only)

This number is the size in bytes of the file on disk, such as 23877.

creation date date (read-only)

This value returns a date object for when the file was created.

modification date date (read-only)

This value returns a date object for when the file was last modified, such as:

date "Saturday, May 20, 2000 9:57:58 AM"

file type string (read-only)

This value is the four-character Mac file type, as in “TEXT” for text files.

file creator string (read-only)

This property is the four-character Mac creator type, as in “R*ch” for BBEdit files or “MSWD” for Word files.

default application alias (read-only)

This is an alias type that identifies the path to the program that would open if you double-clicked this file. For example:

alias "Macintosh HD:Microsoft Office 98:Microsoft Word"

visible boolean (read-only)

Is the file or folder visible? If yes, then this property is true.

icon position point (read-only)

These are the coordinates for the upper-left-hand corner of the file’s or folder’s icon, in the form {50,50}.

folder window bounding rectangle (read-only)

If the item is a folder, these are the coordinates of the upper left and lower right corners of the folder window. The return value looks something like {557, 90, 880, 332}.

folder boolean (read-only)

This is true if the item is a folder.

alias boolean (read-only)

If the item is an alias (rather than a non-alias file or folder), this value is true.

locked boolean (read-only)

If the file is not locked then this value is false. You can lock a file by selecting it, clicking Command-I, and checking the “locked” checkbox in the resulting window. Its icon will have a little padlock on it, and any changes in the file cannot be saved.

short version string (read-only)

The short and long versions apply to the version information in a Get Info window of a file (usually an application). For example, my Script Editor’s short version value is “1.4.3.”

long version string (read-only)

The short and long versions apply to the version information in a Get Info window of a file (usually an application). For example, my Script Editor’s long version value is “1.4.3, Copyright Apple Computer, Inc. 1997-2000.”

busy status boolean (read-only)

If the file is busy or being used by a program, its busy status is true.

URL

This object represents an Internet URL, such as a web, FTP, or newsgroup resource. If your machine is connected to the Web, then the following example will quickly give you the IP address of the web site for which you supply the hostname:

set wAdd to (the text returned of¬
(display dialog "Enter the Web address:" default answer "http://"))
try -- catch user errors entering Web address
   set theURL to wAdd as URL
   display dialog (dotted decimal form of (host of theURL))
   on error
   display dialog "Try me again; you probably mistyped the Web host¬
   name."
end try

The following are URL properties:

web page

This is a class that represents a web page. The following are web page properties:

properties record

This record contains a series of name/value pairs that comprise the web page’s properties. Chapter 3describes the record type.

name string

This string is the name of the web page, such as index.html.

URL URL

This is the URL object of the web page. See the URL class.

text encoding string

This is the text-encoding method used for this page. One encoding method is “application/x-www-form-urlencoded,” which is used for form values that are sent from a web page to a server program.