Greetings,

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.


Thank you for your help,

Joe Alotta


[Abba:~/oldperlcode] josephal% applescript > /tmp/scr
[Abba:~/oldperlcode] josephal% cat /tmp/scr
tell app "preview" to open {alias "/Users/josephalotta/Desktop/charts/chandler51121184-0.02.pdf", alias "/Users/josephalotta/Desktop/charts/chandler51192222-0.01.pdf"}
[Abba:~/oldperlcode] josephal% osascript /tmp/scr
/tmp/scr:28:96: script error: File /Users/josephalotta/Desktop/charts/chandler51121184-0.02.pdf wasn't found. (-43)


edit to remove alias:

[Abba:~/oldperlcode] josephal% applescript > /tmp/scr
[Abba:~/oldperlcode] josephal% cat /tmp/scr
tell app "preview" to open {"/Users/josephalotta/Desktop/charts/chandler51121184-0.02.pdf", "/Users/josephalotta/Desktop/charts/chandler51192222-0.01.pdf"}
[Abba:~/oldperlcode] josephal% osascriptpt >p/scr
[Abba:~/oldperlcode] josephal% osascript /tmp/scr


This opens Preview empty with no files:


[Abba:~/oldperlcode] josephal% cat applescript #!/usr/bin/perl

my $dir = "$ENV{HOME}/Desktop/charts";
opendir DIR, $dir or die $!;
my @files = readdir(DIR);
my @filelist;
for ( @files) {
    /\.pdf$/ and push @filelist,  "\"$dir/$_\"";
}
@filelist = @filelist[4,5];
my $filelist = "{" . (join ", ", @filelist) . "}";
my $script = "tell app \"preview\" to open $filelist";
print $script;


[Abba:~/oldperlcode] josephal%



On Mar 23, 2004, at 6:43 PM, John Delacour wrote:



At 2:01 pm -0600 23/3/04, Joseph Alotta wrote:


Preview opens them as multiple windows. How can I tell Preview to open them as it does in finder?

You might try something like this and run the resulting script as an osascript or one of the Mac modules:


It needn't be as verbose but it's late and I'm off to bed:


my $dir = "$ENV{HOME}/pictures"; opendir DIR, $dir or die $!; my @files = readdir(DIR); my @filelist; for ( @files) { /\.jpg$/ and push @filelist, "alias \"$_\""; } @filelist = @filelist[4,5]; my $filelist = "{" . (join ", ", @filelist) . "}"; my $script = "tell app \"preview\" to open $filelist"; print $script;




Reply via email to