Re: Replace characters in filename
Re: Replace characters in filename
- Subject: Re: Replace characters in filename
- From: Graff <email@hidden>
- Date: Sun, 13 Jun 2004 19:09:47 -0400
On Jun 13, 2004, at 3:08 PM, Christopher Stone wrote:
At 19:36 -0400 06/12/2004, Graff wrought:
Yeah, the Satimage OSAX is nice. I never use it because I try to
keep all my scripts to plain-vanilla AppleScript for portability.
You could of course use the shell to do the same:
______________________________________________________________________
I've got to break down and learn more about shell scripting for that
simple reason, but I really like the Satimage osax for its greater
ease of use and speed.
0.0008507 sec Avg of 10 runs - Satimage osax
0.0175858 sec Avg of 10 runs - Sed shell script
That said, why for goodness sake after all this time doesn't
AppleScript have built-in regular expressions and better text handling
abilities? Shell scripting adds an enormous amount of power but
doesn't count as built-in.
True, AppleScript probably should have regular expressions added to the
Standard Additions as a type of function.
As far as speed, I'm not too worried about it in AppleScript. If I
need to be concerned about speed that's when I turn to Cocoa or Carbon.
Also, remember that most of the speed cost of a "do shell script"
command is in the initialization of the command. For a "do shell
script" command you can get the best performance by combining several
iterations into one text block and then running the command on the
entire block:
set nameBlock to ""
repeat 10 times
set someFileName to quoted form of "aGraphicsFile001A.jpg"
set nameBlock to nameBlock & someFileName & return
end repeat
set fileNameList to paragraphs of (do shell script "echo " & nameBlock
& " | sed s/'[0-9ABDC]'/''/g")
- Ken
_______________________________________________
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.