On Mon, 29 Mar 2004, Joseph Alotta wrote: > [Abba:~/oldperlcode] josephal% du ~/Desktop/charts/ > 4928 /Users/josephalotta/Desktop/charts/ > [Abba:~/oldperlcode] josephal% cat applescript > #!/usr/bin/perl > my $script = <<EOS; > set charts to path to charts folder > tell application "Finder" > set filelist to {} > set pdfs to files in charts whose name ends with ".pdf" > set firstfour to items 1 through 4 of pdfs > repeat with f in firstfour > set end of filelist to f as alias > end repeat > end tell > tell application "Preview" > open filelist > activate > end tell > EOS > `osascript -e '$script'`; > > [Abba:~/oldperlcode] josephal% applescript > 22:35: syntax error: A property can't go after this identifier. (-2740) > [Abba:~/oldperlcode] josephal%
Again, trying to wrap this in Perl is just making things more complex for you. You can put your OSA code directly into an OSAscript script: $ cat ~/bin/osatest.sh #!/usr/bin/osascript set charts to path to charts folder tell application "Finder" set filelist to {} set pdfs to files in charts whose name ends with ".pdf" set firstfour to items 1 through 4 of pdfs repeat with f in firstfour set end of filelist to f as alias end repeat end tell tell application "Preview" open filelist activate end tell Unfortunately, I get the same error you do when I try to run it: $ ./osatest.sh ## Component Manager: attempting to find symbols in a component alias of type (regR/carP/x!bt) syntax error: A unknown token can't go after this some object. (-2740) $ (Nb. I'm testing on a 10.2 machine right now, which may explain the first error; the second error is probably more important right now.) I don't know enough about debugging AppleScript / OSAscript to push this any further at the moment, but you may be able to get it to dump some print statement or something so that you can at least see where it's breaking down. Or, failing that, you can use Chris Nandor's nice wrapper libraries and then have a legit reason to do this in Perl... :-) -- Chris Devers