• 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: Shell-Perl-AppleScript scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell-Perl-AppleScript scripting


  • Subject: Re: Shell-Perl-AppleScript scripting
  • From: Stevan Reese <email@hidden>
  • Date: Mon, 29 Dec 2003 00:15:12 -0500

IF we are talking AppleScript in OS X 10.3 then I have discovered another option.
When you save your script, you have a few options, including --
Script
Application
Script Bundle
Application Bundle
Text

If you save the script as an Application Bundle, you can place your perl script in the bundle structure and call it or use it as you see fit.
To be more specific.
#!/usr/bin/perl
BEGIN {
chomp($ARGV [0] = <<'UnLiKeLyStRiNg');
your search string goes here, as is
UnLiKeLyStRiNg
chomp($ARGV [1] = <<'UnLiKeLyStRiNg');
your replace string goes here, as is
UnLiKeLyStRiNg
}
s/$ARGV [0]/$ARGV [1]/g;

save this to /path to myscript/Content/Resources/searchreplace.pl
Add something like this to the beginning of your script
set PathToMe to path to me as text
set PathToMeToo to (quoted form of POSIX path of PathToMe) as text
set PathToResources to PathToMeToo & "/Contents/Resources/"
call the perl script with
do shell script PathToResources & "your arguments"

Does this make any sense?
stevan



On Dec 28, 2003, at 10:12 PM, John Fowler wrote:

The distinguished Randall Schwartz wrote:

The general strategy for a good delimiter is like this:

BEGIN {
chomp($search = <<'UnLiKeLyStRiNg');
your search string goes here, as is
UnLiKeLyStRiNg
chomp($replace = <<'UnLiKeLyStRiNg');
your replace string goes here, as is
UnLiKeLyStRiNg
}
s/$search/$replace/g;


My other concern about this quoting method in the context of an AppleScript do shell script command is that it is not consistent with a one-line perl script....

John Fowler
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Shell-Perl-AppleScript scripting
      • From: John Fowler <email@hidden>
References: 
 >Re: Shell-Perl-AppleScript scripting (From: John Fowler <email@hidden>)

  • Prev by Date: Re: Shell-Perl-AppleScript scripting
  • Next by Date: Re: [OT] Verification required?
  • Previous by thread: Re: Shell-Perl-AppleScript scripting
  • Next by thread: Re: Shell-Perl-AppleScript scripting
  • Index(es):
    • Date
    • Thread