🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15079

Changing the contents property of a word (IDCS)

#15079
From: Cris_Lawrence
Date: Tue, 16 Dec 2003 17:00
18 lines
2367 bytes
I am a newcomer to Applescript and I am trying to translate a working program I wrote using VB for ID2 to Applescript for IDCS. I am executing a search for a product string that serves as a place holder for a price. I later replace that product string with the price string. Since the product string guides my price lookup procedure, which requires a fair amount of coding, I can't really perform a straight search and replace. So my intent is to simply change the contents property of the result of the search to reflect the price once I collect it. I have not been successful in modifying the contents property here even though I have done something quite similar in VB. A bare bones version of my code is shown below (document assumed loaded into IDCS):

tell application "InDesign CS"
		activate
		set myDocument to active document
		tell myDocument
			set myPriceHolderList to search for "$38378264M01$" with find attributes {applied paragraph style:"Series"}
			repeat with myPriceHolder in myPriceHolderList
				display dialog class of myPriceHolder as string
				display dialog myPriceHolder as string
				display dialog contents of myPriceHolder as string
				set point size of myPriceHolder to 7
				set contents of myPriceHolder to "$PRICE"
			end repeat
		end tell
	end tell

I can change the point size of the search text even though the following statement to set the contents of the search result is ineffective. I can successfully perform a search and replace on the search string at this point, but I view that solution as a workaround. The class type returned in the display dialog indicates that myPriceHolder is a 'word' and so should possess a contents property. What am I doing wrong? Grateful for any help provided. - Cris
Technical Details
Message-ID: <2ccef3cf.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,6afd82e038dd93a1,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-12-16 09:07:55 PST
From: Cris_Lawrence@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Changing the contents property of a word (IDCS)
Message-ID: <2ccef3cf.-1@webx.la2eafNXanI>
Date: Tue, 16 Dec 2003 09:00:53 -0800
Lines: 35
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit