John,

I tried modifying this to work on my system. The folder is ~/Desktop/charts and the files are .pdf's.

You got to love that explanatory error message.

Joe Alotta



[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%


On Mar 24, 2004, at 12:07 PM, John Delacour wrote:



At 10:02 am -0600 24/3/04, Joseph Alotta wrote:


I'm still playing around with the applescript code to try to make it work according to the suggestions here. Seems it needs "alias" to tell it to open files, but can't find them if you completely path them.

My fault. I told you I was tired.


You need to use Mac:paths: and not unix/paths/

You can work out for yourself a way to do that but here is a working example of a plain AppleScript way to open the first 4 jpgs in your pictures folder:



my $script = <<EOS;
set pics to path to pictures folder
tell application "Finder"
        set filelist to {}
        set jpgs to files in pics whose name ends with ".jpg"
        set firstfour to items 1 through 4 of jpgs
        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'`




Reply via email to