Re: Getting Returned Properties to the Clipboard or a Text Log
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