MacPerl::AppleScript 0.02
Sponsored Links
MacPerl::AppleScript 0.02 Ranking & Summary
File size:
0.014 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1100
Date added:
2006-10-20
Publisher:
Wolfgang Kinkeldei
MacPerl::AppleScript 0.02 description
MacPerl::AppleScript is a Perl extension for easily accessing scriptable Apps.
SYNOPSIS
use MacPerl::AppleScript;
#
# create Application Object
#
my $app = MacPerl::AppleScript->new("Application Name");
my $doc1 = $application->new("document 1");
my $doc2 = $application->new("document 2 of $app");
#
# directly execute Script in Application
# (auto-creates a tell "Application Name" block for you
#
$app->execute("some applescript command");
$app->execute(["some applescript command", "..." ... ]);
$app->execute("some applescript command", "..." ... );
#
# alternative way using a hashref
# script: script to get executed (string or array-ref)
# object: optional, object to be named in the "tell" block
# timeout: optional, timeout in seconds
#
$app->execute({
script => [...],
object => $doc1,
timeout => 10,
});
#
# calling functions
#
$app->open(POSIX path "/path/to/file" as alias);
$app->open($app->convert_path(/path/to/file,alias));
$doc->close();
$app->close($doc1);
#
# string interpolation to Applescript Object Name
# gets application "Application Name" for $application
# gets document 1 of application "Application Name" for $doc1
#
my $ascript_appname = "$app";
my $ascript_docname = "$doc1";
$app->execute("close $doc1"); # cool :-)
#
# getting/setting properties
#
my $foo_property = $app->{foo};
my $foo_bar_prop = $doc1->{foo bar};
my $foo_bar_prop = $doc1->{foo_bar};
$app->{bar} = "any value";
$doc1->{foo bar} = [1,2,3,4];
$doc1->{foo_bar} = {a=>1, b=>2};
my %properties = %{$app};
This module is not written for being efficient. In fact it is really inefficient but hopefully easy to use.
As AppleScript (and its way of communicating to Applications) usually has some kind of latency. The creation of readable code is the most important goal when writing this Module.
Another reason for some kind of inefficiency results in the technical problem that AppleScript is a strongly typed language. Converting types back to Perl is easy. But the other direction is not always clear, as converting a scalar from Perl to AppleScript needs some guessing.
The parts of the code that deal with these problems do some tries with different AppleScript commands wrapped in try-blocks. So usually one of the expression works without errors. The same approach is made with hash keys that can contain spaces or underscores inside the key name.
This module assumes that all strings are correctly encoded in perl internals coding sheme based on Unicode. During the conversion to AppleScript all characters inside strings that are not ascii-clean are converted to strange looking unicode-string constructing sequences. I tested a lot of character schemes including west- and mid-european languages as well as russian, greek and arabic with some applications without getting problems.
SYNOPSIS
use MacPerl::AppleScript;
#
# create Application Object
#
my $app = MacPerl::AppleScript->new("Application Name");
my $doc1 = $application->new("document 1");
my $doc2 = $application->new("document 2 of $app");
#
# directly execute Script in Application
# (auto-creates a tell "Application Name" block for you
#
$app->execute("some applescript command");
$app->execute(["some applescript command", "..." ... ]);
$app->execute("some applescript command", "..." ... );
#
# alternative way using a hashref
# script: script to get executed (string or array-ref)
# object: optional, object to be named in the "tell" block
# timeout: optional, timeout in seconds
#
$app->execute({
script => [...],
object => $doc1,
timeout => 10,
});
#
# calling functions
#
$app->open(POSIX path "/path/to/file" as alias);
$app->open($app->convert_path(/path/to/file,alias));
$doc->close();
$app->close($doc1);
#
# string interpolation to Applescript Object Name
# gets application "Application Name" for $application
# gets document 1 of application "Application Name" for $doc1
#
my $ascript_appname = "$app";
my $ascript_docname = "$doc1";
$app->execute("close $doc1"); # cool :-)
#
# getting/setting properties
#
my $foo_property = $app->{foo};
my $foo_bar_prop = $doc1->{foo bar};
my $foo_bar_prop = $doc1->{foo_bar};
$app->{bar} = "any value";
$doc1->{foo bar} = [1,2,3,4];
$doc1->{foo_bar} = {a=>1, b=>2};
my %properties = %{$app};
This module is not written for being efficient. In fact it is really inefficient but hopefully easy to use.
As AppleScript (and its way of communicating to Applications) usually has some kind of latency. The creation of readable code is the most important goal when writing this Module.
Another reason for some kind of inefficiency results in the technical problem that AppleScript is a strongly typed language. Converting types back to Perl is easy. But the other direction is not always clear, as converting a scalar from Perl to AppleScript needs some guessing.
The parts of the code that deal with these problems do some tries with different AppleScript commands wrapped in try-blocks. So usually one of the expression works without errors. The same approach is made with hash keys that can contain spaces or underscores inside the key name.
This module assumes that all strings are correctly encoded in perl internals coding sheme based on Unicode. During the conversion to AppleScript all characters inside strings that are not ascii-clean are converted to strange looking unicode-string constructing sequences. I tested a lot of character schemes including west- and mid-european languages as well as russian, greek and arabic with some applications without getting problems.
MacPerl::AppleScript 0.02 Screenshot
MacPerl::AppleScript 0.02 Keywords
AppleScript
MacPerl
AppleScript 0.02
Apps
perl extension
APPLICATION NAME
application
Foo
bar
Perl
name
execute
MacPerl::AppleScript
MacPerlAppleScript
MacPerl::AppleScript 0.02
Libraries
Bookmark MacPerl::AppleScript 0.02
MacPerl::AppleScript 0.02 Copyright
WareSeeker periodically updates pricing and software information of MacPerl::AppleScript 0.02 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of MacPerl::AppleScript 0.02 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
application data
passport application
macperl osx
applescript language guide
application development trends
application manager
applescript tutorial
application status
applescript editor
job application
applescript xcode
ftp upload applescript
applications for ipod touch
job applications
perl extension implementing
applescript help
common application
application for employment
Related Software
AIX::Perfstat is a Perl wrapper for perfstat() functions. Free Download
Apache::AuthPerLDAP is a mod_perl PerLDAP Authentication Module. Free Download
Archive::Any::Create is an abstract API to create archives (tar.gz and zip). Free Download
PostScript::Graph::Bar Perl module can draw a bar chart on a postscript file. Free Download
MMDS::Properties Perl module contains flexible properties handling for MMDS. Free Download
App::SimpleScan::Plugin::Forget is a Perl module to forget a variables value. Free Download
Module::Starter::Smart is a Perl module that lets you add new modules into an existing distribution. Free Download
XML::Writer::Simple is a Perl module to create XML files easily! Free Download
Latest Software
Popular Software
Favourite Software