🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18843

Re: (AS) make a text frame in a cell - how?

#18843
From: Armin.Egginger
Date: Wed, 12 Feb 2003 14:22
70 lines
3313 bytes
Hi,

found an scriptpart in the forum to place a textframe in the cell. - place a picture in parent of the first pictureframe, delete the picture und set contents to text.
But I have 2 Problems with my script.

1. It functions only with .eps files - no .tif, .psd, .. files functions - why? I don't know

2. I can't set the right position of the new textframe. How to calculate the right geometric bounds? Or do I have to change another part of the properties?

-myscript
global thepictpath, thepictname

tell application "Finder"
	set theheight to 90
	set thetfheight to 8
	set thewidth to 90
	set thefolderpath to (choose folder with prompt "choose the picture folder")
	repeat with i from 1 to (count every file of folder thefolderpath)
		getthepictpath(thefolderpath, i) of me
		putpict(thepictpath, thepictname, i, theheight, thewidth, thetfheight) of me
	end repeat
end tell

on putpict(thePath, thename, y, theheight, thewidth, thetfheight)
	tell application "InDesign 2.0.2"
		set myDocument to active document
		tell table 1 of text frame 1 of page 1 of myDocument
			tell insertion point 1 of cell y
				set myimageframe to place thePath
			end tell
			tell cell y
				tell paragraph 1 to set justification to center
				set properties of text frame 1 to {geometric bounds:{0, 0, (theheight as number), (thewidth as number)}}
				set myframe to text frame 1
				tell myframe
					fit myframe given content to frame
					fit myframe given proportionally
					fit myframe given center content
					fit myframe given frame to content
				end tell
			end tell
			tell insertion point -1 of cell y
				set myGraphic to place thePath
				set mytxtFrame to parent of myGraphic
				tell myGraphic to delete
				set content type of mytxtFrame to text type
				set geometric bounds of mytxtFrame to {0, 0, (thetfheight as number), 80}
				set text of mytxtFrame to (thename as string)
			end tell
		end tell
	end tell
end putpict

on getthepictpath(thefolderpath, z)
	tell application "Finder"
		set thefiles to every file in folder thefolderpath
		set thefilesname to name of every file in folder thefolderpath
		set thepictpath to ((item z of thefiles) as alias)
		set thepictname to item z of thefilesname
	end tell
end getthepictpath

My base is an ID-page => size 420x594 mm with a table on text frame 1 {columns: 4, rows: 4, height: 100, width: 100}

Is there a way to solve these problems?

Many thanks

Armin
the ID-Script beginnger
Technical Details
Message-ID: <1de7d199.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de7d199.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,f4c636a2ee91d8b8
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-12 06:38:07 PST
From: Armin.Egginger <armin.egginger@gmx.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: (AS) make a text frame in a cell - how?
Message-ID: <1de7d199.0@WebX.la2eafNXanI>
Date: Wed, 12 Feb 2003 06:22:54 -0800
References: <1de7d199.-1@WebX.la2eafNXanI>
Lines: 80
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit