• 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: QuarkXpress Find/Change with style sheets?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: QuarkXpress Find/Change with style sheets?


  • Subject: RE: QuarkXpress Find/Change with style sheets?
  • From: "Sprague, Graham" <email@hidden>
  • Date: Tue, 1 May 2001 11:02:46 -0400

Thanks Hans! This is great. I would have been struggling with this for a
long time. Your help is greatly appreciated!

Thanks,
Graham

> ----------
> From: Hans Haesler
> Sent: Monday, April 30, 2001 3:43 PM
> To: AS lists
> Subject: Re: QuarkXpress Find/Change with style sheets?
>
> On Mon, 30 Apr 2001, Graham Sprague wrote:
>
> >Does any one know how to script the find/change function in QuarkXpress?
> <snip>
> >I am using a tag theme. I have text in to Quark with tags like "@Head" or
> >>"@Body" or "@Price" then I am following each section with a hard return.
> >Then I can search and replace each tag with "" (Nothing) and a style
> sheet
> >of my choice. It all works great but I have no idea where to begin with
> >trying to script this.
>
> Graham,
>
> your example didn't made it through (Chuq is very good at trashing
> attachments -- fortunately, I'd say ;-).
>
> Anyway, I don't understand why you don't tell your typist to add a colon
> on each tag. Like this: "@Head:". Then you'd have a valid tag of a style
> sheet name (without the quotes), and when you import the file, the style
> sheet converts the formatting of the text. Provided, that the style spec
> "Head" exists. No need for Find/Replace.
>
>
> Maybe you insist on doing it the hard way, then you could do this:
> ---
> tell document 1 of application "QuarkXPress 4.11"
> activate
> tell current box
> tell story 1
> repeat with i from 1 to count paragraphs
> tell paragraph i
> if it starts with "@Head" then
> delete (characters 1 thru 5)
> set style sheet to "Head"
> else if it starts with "@Body" then
> delete (characters 1 thru 5)
> set style sheet to "Body"
> else if it starts with "@Price" then
> delete (characters 1 thru 6)
> set style sheet to "Price"
> end if
> end tell
> end repeat
> end tell
> end tell
> end tell
> ---
>
> A much faster solution would be: save the text as XPress Tags in a file,
> read the file in a variable, do a search/replace using the text item
> delimiters, write the string to the file and replace the story in the box:
> ---
> set tagsPath to ((path to startup disk) as string) & "test.xtg"
> tell application "QuarkXPress 4.11"
> activate
> set searchList to {"<\\@>Head", "<\\@>Body", "<\\@>Price"}
> set replaceList to {"@Head:", "@Body:", "@Price:"}
> set convert quotes to true
> set import styles to true
> tell document 1
> tell current box
> save story 1 in tagsPath as "TEXT"
> end tell
> set aString to read file tagsPath
> repeat with i from 1 to count of searchList
> set sStr to item i of searchList
> set rStr to item i of replaceList
> set aString to my searchReplace(sStr, rStr, aString)
> end repeat
> try
> open for access file tagsPath with write permission
> set eof of file tagsPath to 0
> write aString to file tagsPath
> close access file tagsPath
> on error
> close access file tagsPath
> end try
> tell current box
> set story 1 to alias tagsPath
> end tell
> end tell
> end tell
>
> on searchReplace(s, r, t)
> set AppleScript's text item delimiters to (s)
> set aList to (every text item of t)
> set AppleScript's text item delimiters to (r)
> set t to aList as string
> set AppleScript's text item delimiters to ""
> return t
> end searchReplace
> ---
>
> This works for me. However, I'm not happy with using the "@" character
> as a visible tag. Look at what we must do for finding it...
>
> Regards,
>
> Hans
>
> ---
> Hans Haesler | email@hidden
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Prev by Date: Re: Fastest Alphabetizer(sorter) for Lists
  • Next by Date: Re: Precision timer OSAX
  • Previous by thread: Re: Fastest Alphabetizer(sorter) for Lists
  • Next by thread: Re: Precision timer OSAX
  • Index(es):
    • Date
    • Thread