Re: How to Do This Without Smile or Satimage
Re: How to Do This Without Smile or Satimage
- Subject: Re: How to Do This Without Smile or Satimage
- From: Axel Luttgens <email@hidden>
- Date: Wed, 29 Feb 2012 09:23:35 +0100
Le 28 févr. 2012 à 11:40, Rick Gordon a écrit :
> I'm looking for a way to implement regex operations to a string or variable without using Smile, Satimage, or some other external resource. I'm thinking that there must be a way to formulate this as a shell command (using perl -e, sed, or something), but what I'm finding seems to be that those things would be operating on a file, and I just want to act on passed strings (within the context of a repeat loop on targeted objects).
>
> tell application "Adobe InDesign CS5"
> tell applied paragraph style
> set vParaStyleNameIn to name as string
> tell application "Smile"
> set vParaStyleNameOut to uchange "indent" into "flush" in vParaStyleNameIn ¬
> with regexp without case sensitive
> end tell
> end tell
> end tell
>
> It seems so simple; there must be a way.
Hello Rick,
Still wondering why Shane's initial sugestion hasn't made its way... For example:
on uchange(InputText, Match, ChangeTo)
local TIDs, OutputText
set TIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {Match}
set OutputText to text items of InputText
set AppleScript's text item delimiters to {ChangeTo}
set OutputText to OutputText as text
set AppleScript's text item delimiters to TIDs
return OutputText
end uchange
uchange("To indent this one", "indent", "flush")
--> "To flush this one"
Do you have special requirements needing to resort to "do shell script"?
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden