• 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: Getting Returned Properties to the Clipboard or a Text Log
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Returned Properties to the Clipboard or a Text Log


  • Subject: Re: Getting Returned Properties to the Clipboard or a Text Log
  • From: Rick Gordon <email@hidden>
  • Date: Fri, 17 Aug 2007 15:09:06 -0700

Whoops! Missed the first few lines of code

--

So, in case anyone else finds it useful, here is a working prototype of my script, using Smile for regular expressions:

property pDoubleSpace : false
property pSetClipboard : true
property pWriteLog : false

tell application "Adobe InDesign CS3"
  try
    set vSelection to object reference of selection of active document
  on error
    display dialog "Could not get selection of active document." buttons {"OK"} default button "OK"
    return
  end try

  tell vSelection
    set vPropertyList to get properties
    try
      set vErrorTrigger to load script vPropertyList
    on error vPropertyList
      set AppleScript's text item delimiters to "{"
      set vPropertyList to every text item of vPropertyList
      set vPropertyList to the rest of vPropertyList as string
      set AppleScript's text item delimiters to "}"
      set vPropertyList to text items 1 thru -2 of vPropertyList
      set vPropertyText to vPropertyList as string

      tell application "Smile"
        set vPropertyText to coerceAsUnicodeText vPropertyText
        set vPropertyText to uchange "\\\"" into "\"" in vPropertyText
        set vPropertyText to uchange ", " into return in vPropertyText
        --START INDESIGN-SPECIFIC
        set vPropertyText to uchange " of document \\\".+$" into "" in vPropertyText with regexp
        set vDone to false
        repeat until vDone is true
          try
            --FIRST LINE WILL GENERATE ERROR ON FAIL
            set vRecord to ufind text "({[^}]+)[\\n\\r]" using "\\1, " in vPropertyText with regexp
            set vPropertyText to uchange "({[^}]+)[\\n\\r]" into "\\1, " in vPropertyText with regexp
          on error
            set vDone to true
          end try
        end repeat
        --END INDESIGN-SPECIFIC
        if pDoubleSpace is true then set vPropertyText to uchange return into return & return in vPropertyText
      end tell
    end try
  end tell
  if pSetClipboard is true then set the clipboard to vPropertyText
  --WRITING LOG NOT YET IMPLEMENTED
  return vPropertyText
end tell

------------------

On 8/16/07 at 12:19 PM -0700, Stockly, Ed wrote in a message entitled
"Re: Getting Returned Properties to the Clipboard or a Text ":

>Rick,
>
>Here is a quick and dirty (very dirty) way to get that:
>tell application "Adobe InDesign CS2"
>    try
>        set vSelection to object reference of selection of active document
>    on error
>        display dialog "Could not get selection of active document." buttons
>{"OK"} default button "OK"
>        return
>    end try
>tell vSelection
>        set vPropList to get properties
>        try
>            set errorTrigger to load script vPropList
>        on error vPropList
>            set AppleScript's text item delimiters to "{"
>            set vPropList to every text item of vPropList
>            set vPropList to the rest of vPropList as string
>            set AppleScript's text item delimiters to "}"
>            set vPropList to text items 1 thru -2 of vPropList
>            set AppleScript's text item delimiters to "}" & return
>            set propertyText to vPropList as string
>        end try
>    end tell
>end tell
>return propertyText

--

___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

WWW:   http://www.shelterpub.com
 _______________________________________________
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
--

___________________________________________________

RICK GORDON
EMERALD VALLEY GRAPHICS AND CONSULTING
___________________________________________________

EMAIL: email@hidden
PHONE: 415-663-8652

WWW:   http://www.shelterpub.com
 _______________________________________________
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

  • Prev by Date: Re: Getting Returned Properties to the Clipboard or a Text Log
  • Next by Date: Re: A Better Regex
  • Previous by thread: Can I address indesigns datamerge feature?
  • Next by thread: Q: Using (sound) volume settings
  • Index(es):
    • Date
    • Thread