O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Apple System Profiler

Syntax

tell app "Apple System Profiler"
   (* get the machine's IP address *)
   get TCPIP address
end tell

Dictionary commands

open object or list of objects

This command opens an ASP report, as in the following example:

set rep to "macintosh hd:desktop folder:ASP report" as alias 
tell application "Apple System Profiler"
   activate bring ASP to the front
   open rep
end tell
print object or list of objects to print

This prints a report, as in print ASPreportFile displaying print dialog true as text.

displaying print dialog (boolean)

This is an optional true/false value. If it’s true, it displays a dialog for setting printing preferences prior to printing the ASP report.

as (text/shown on screen)

This is an optional labeled parameter involving whether to print out the report as text or as it is laid out on screen in the ASP document.

quit

This command quits ASP.

run

This command sends a run Apple event to ASP, which is the same as double-clicking the program’s icon on the desktop. This opens the application if it is not already open.

close reference to object

This closes an ASP report, optionally saving it in a file. Here is example code:

close report "ASPreport" saving ask

saving yes/no/ask

The optional saving labeled parameter takes one of three constants. yes saves the report with a default name in ASP’s directory (which is the Apple Menu Items folder), no just closes the report without saving it, and ask displays a dialog that the user can use optionally to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required