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

Re: [MacPerl] MacPerl and Apple Script



Brian Eaton <b_edgar@cats.ucsc.edu> writes:
[snip]
}
}I imagine something like this:

Right idea, wrong quotes.

}foreach (@list) {
}	&MacPerl'DoAppleScript(<<'END_SCRIPT');

        MacPerl::DoAppleScript(<<END_SCRIPT);

The single quotes you're using tells Perl to take everything you write in
the block literally.  You're telling CodeWarrior to Add File a file
literally named $_, which isn't what you want.  If you use double quotes,
or the equivalent no quotes, Perl will interpolate the value of $_ into the
string before sending it to Applescript.

}	tell application "CodeWarrior IDE 1.6"
}		Add File "$_"
}	end tell
}	END_SCRIPT
}}
}

I have no idea what Add File does, but it might be much faster, if it takes
multiple files as arguments, to do something like:

$files = join(" ",@files);

MacPerl::DoAppleScript(<<END_SCRIPT);
tell application "CodeWarrior IDE 1.6"
	Add File "$files"
end tell
END_SCRIPT

The fewer times you call Applescript, the faster your script will run.  Of
course, there may be size limitations in Applescript that you have to deal
with.



}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


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us