[Pdx-pm] method required text, how do I give it a variable?

Thomas J Keller kellert at ohsu.edu
Tue Jun 15 15:04:09 CDT 2004


Greetings,

I want to use Mac::AppleScript to launch something on a Mac running OS X

the module has a function called RunAppleScript that apparently only 
takes text as input:
Usage: Mac::AppleScript::RunAppleScript(text) at test_mac_as line 13.

I want to hand it a variable. Here's the code that does work, followed 
by what I thought should work but doesn't

########## This works ########
use Mac::AppleScript qw(RunAppleScript);

RunAppleScript(qq(tell application "Finder"\nactivate\ndisplay dialog 
"Greetings from Perl!"\nend tell))
	or die "Didn't work.\n";

############ This doesn't work, even though $string is what I want 
interpolated  #######
use Mac::AppleScript qw(RunAppleScript);

my @apples = <<EOL =~ m/\S.*\S/g;
	qq(tell application "Finder"\\n
		activate\\n
		display dialog "Greetings from Perl!"\\n
	end tell)
EOL

my $string = join "", @apples;
print "$string\n";

RunAppleScript($string)
	or die "Didn't work.\n";

##########################

Your assistance will be greatly appreciated.
regards,
Tom K.

Tom Keller, Ph.D.
http://www.ohsu.edu/research/core
kellert at ohsu.edu
503-494-2442
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1187 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/pdx-pm-list/attachments/20040615/5f9bf177/attachment.bin


More information about the Pdx-pm-list mailing list