Monday, December 11, 2017

#1 2012-10-19 09:51:25 am

kobrien1
Member
Registered: 2010-09-16
Posts: 5

Trying to write a grep style applescript

Whenever I try and compile a grep style script it either performs the code IE puts a hard return in the script or tells me unknown token meaning it is reading the \ between the quotes as a return. What can be done? i am sure there is an easy fix and I think scripting grep styles could be huge.
Thanks


tell application "Adobe InDesign CS4"
   
    set find grep preferences to nothing
   
    set change grep preferences to nothing
   
    --Search the document for the string "\r\s*$".
   
    set find what of find grep preferences to "\r\s*$" as string
   
    --Replace the search with blank
   
    set change to of change grep preferences to " "
   
    -- this is the actual search and replace command
    set myFoundItems to change text
   
   
end tell

Offline

 

#2 2012-10-19 05:26:47 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5197

Re: Trying to write a grep style applescript

You have to escape the backslashes with another backslash.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)