• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to do some AppleScript inside a Perl program to label duplicates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do some AppleScript inside a Perl program to label duplicates


  • Subject: Re: How to do some AppleScript inside a Perl program to label duplicates
  • From: "Mark J. Reed" <email@hidden>
  • Date: Sat, 17 Sep 2005 00:15:59 -0400

A minor suggestion to avoid giving migraines to Perl programmers:
instead of embedding a shell command with a shell heredoc in
backticks, just run osascript and print the script at it using a perl
here-doc, like so:

open(OSASCRIPT, "|osascript") or die "$0: couldn't run osascript: $!\n";
print OSASCSRIPT <<ENDSCRIPT;
tell application "Finder"
   do something
end tell
ENDSCRIPT



On 9/16/05, Gary (Lists) <email@hidden> wrote:
> "pete boardman" wrote:
>
> > On 16 Sep 2005, at 16:52, Adam Wuellner wrote:
> >> for (@{$pair{$i}}) {
> >>     print $$_,"\n";
> >>     system("osascript -e 'tell application \"Finder\" to set the label
> >> index of (POSIX file \"$$_\") to 6'");
> >> }
> > Adam - this work brilliantly for me! I was still pondering how to
> > install some Perl modules, but this saves me the bother. No stack
> > overflow yet...
>
> A very nice application of...
>
> > On 16 Sep 2005, at 17:02, Doug McNutt wrote:
> >> The CLI tool osascript allows ApleScript syntax to be compiled and
> >> executed from a command line.
> [...]
> >> osascript << ENDSCRIPT
> >> tell application "Finder"
> >>     do something
> >> end tell
> >> ENDSCRIPT
> >>
> >> Efficient it is not. But it is simple.
> >
> > Suits me! Fortunately, I can go and make a cup of tea while this runs...
>
> ...this principle.
>
> Very cool stuff. Suits me as well.
>
> I have not needed (and therefore haven't read) osascript's man.  That's now
> on my to-do list.
>
> For my tasks, which are often low-volume but repetitive, this kind of
> so(u)rcery is perfect.
>
> Thanks Doug, and Adam, for the excellent follow-up.
> --
> Gary
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: How to do some AppleScript inside a Perl program to label duplicates (From: pete boardman <email@hidden>)
 >Re: How to do some AppleScript inside a Perl program to label duplicates (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: How to do some AppleScript inside a Perl program to label duplicates
  • Next by Date: Re: Running scripts from cron AND passing arguments
  • Previous by thread: Re: How to do some AppleScript inside a Perl program to label duplicates
  • Next by thread: Re: How to do some AppleScript inside a Perl program to label duplicates
  • Index(es):
    • Date
    • Thread