[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] MacPerl and Apple Script



Greetings.  I've been playing with Perl for a couple of weeks now, and am
beginning to feel fairly comfortable with the more basic parts of the
language.  Perl seems to be an easy language to learn and use, made even
easier because it's so widespread.  Whenever I've gotten stuck, I've been
able to find an already written script which I can learn from.  Until now.

The short version of my problem is this: I have a list of file names in a
Perl script.  How do I get that list to an Apple Script?

Longer version: I have 30 or so codewarrior project files I can't read,
because my version of CW is out of date.  I've already written a Perl
script to go through the files and pick out anything that looks like a
library, header file, or resource, and put those files in a list.  Now I
COULD go ahead and attach each header file to a project manually, but that
would mean several hours of repetitive mouse movement.  Much more fun to
spend several hours getting MacPerl to do it for me.

I imagine something like this:
foreach (@list) {
	&MacPerl'DoAppleScript(<<'END_SCRIPT');
	tell application "CodeWarrior IDE 1.6"
		Add File "$_"
	end tell
	END_SCRIPT
}

Unfortunately, this doesn't work.  Does anyone out there have experience
with something like this?  Would it make more sense (or even be possible)
to call Perl from an Apple Script, and have Perl return the file (or list
of files) to check?

Any suggestions, advice, or pointers to a good resource would be helpful.

Thanks much.

Brian