The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mac::AppleScript::Glue::Application - an application to send AppleScript to

SYNOPSIS

    use Mac::AppleScript::Glue;
    use Mac::AppleScript::Glue::Application;

    my $finder = new Mac::AppleScript::Glue::Application('Finder');

    my $version = $finder->version;

DESCRIPTION

Objects of this module are used to send events to an application.

See Mac::AppleScript::Glue for full information on how to use this package.

METHODS

new($app_name [, $machine ])

Creates a new application object for the $app_name application.

If $machine is specified, the specified computer will be sent events instead of the local machine. This uses Apple Remote Events, which you'll have to have enabled on the remote machine before events can be sent to it. (Look in the Sharing system preference or control panel on the remote machine.)

NOTE: Documentation on remote events is a little vague; it seems that you specify the remote machine as a URL like eppc://<host>, where <host> is either a hostname or IP address. "EPPC" stands for Event Program to Program Communication, apparently.

app_name

Returns the name of the application connected to this object.

ref

Returns the AppleScript object reference for this application.

run(@script)

Sends a user-specified AppleScript to this application. The script can be a simple one-liner or a multi-line script; in either case, script lines should not contain newlines. If the script returns a value, it will be parsed into Perl data structures.

objref($ref)
objref($class => $string)

Creates an object reference to use as a standalone object. If you have a complete object reference (like application "Finder"), you can pass that as a single argument:

    $app->objref('application "Finder"');

You can also have objref() make up the object reference for you out of a class and string:

    $app->objref(application => 'Finder');

This is simply a shortcut to calling Mac::AppleScript::Glue::Object's new method.

SEE ALSO

Mac::AppleScript::Glue

Mac::AppleScript::Glue::Application

AUTHOR

John Labovitz <johnl@johnlabovitz.com>

COPYRIGHT

Copyright (c) 2002 John Labovitz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.