• 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: Replace all caps into plain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace all caps into plain


  • Subject: Re: Replace all caps into plain
  • From: Hans Haesler <email@hidden>
  • Date: Wed, 27 Dec 2006 14:38:05 +0100

On Wed, 27 Dec 2006, Jan Bultereys wrote:

>Yes this works, can you tell me if this modified version is the 'fastest'
>approach to 'clean' a file? Many thanks for your feedback.

Hi Jan,

what version of QuarkXPress are you using? Depending on this,
one could speed up things this way or that way.

However, if you're showing a dialog for each hit, then it
wouldn't matter much if the code would be a little faster.

Anyway, I think it would be better to address the stories
(instead of the text boxes). Just to make sure that each text
style frame is treateed only once (if there are linked boxes).

From your code I understand that you're still trying
to get a selection. Please try this:
---
tell document 1 of application "QuarkXPress Passport"
  activate
  repeat with s from 1 to (count of stories)
    tell story s
      repeat with i from (count of text style ranges) to 1 by -1
        tell text style range i
          if on styles of (get style) is {all caps} then
            set objRef to object reference
            my selText(objRef)
            set bR to button returned of (display dialog "All Caps?" buttons ¬
              {" Cancel ", "All Caps", "Plain"} default button 3)
            if bR is "Plain" then
              my setPlain(objRef)
            else if bR is " Cancel " then
              error number -128
            end if
          else if on styles of (get style) is {italic, all caps} then
            set objRef to object reference
            my selText(objRef)
            set bR to button returned of (display dialog "Italic, All Caps?" buttons ¬
              {" Cancel ", "Italic, All Caps", "Plain"} default button 3)
            if bR is "Plain" then
              my setPlain(objRef)
            else if bR is " Cancel " then
              error number -128
            end if
          end if
        end tell
      end repeat
    end tell
  end repeat
end tell

on selText(objRef)
  tell application "QuarkXPress Passport"
    set selection to objRef
  end tell
end selText

on setPlain(objRef)
  tell application "QuarkXPress Passport"
    tell objRef
      set style to plain
    end tell
  end tell
end setPlain
---

Regards,
Hans


 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Replace all caps into plain
      • From: Jan Bultereys <email@hidden>
References: 
 >Re: Replace all caps into plain (From: Hans Haesler <email@hidden>)
 >Re: Replace all caps into plain (From: Jan Bultereys <email@hidden>)

  • Prev by Date: Re: Replace all caps into plain
  • Next by Date: Re: Replace all caps into plain
  • Previous by thread: Re: Replace all caps into plain
  • Next by thread: Re: Replace all caps into plain
  • Index(es):
    • Date
    • Thread