🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20648

As: Select text frame and paste from clipboard??

#20648
From: Kari Puikkonen
Date: Fri, 28 Jun 2002 15:07
49 lines
2422 bytes
I have manipulated this script, which I found from this forum, to my purposes. 

tell application "InDesign 2.0.1" 
	tell document 1 
		set theBody to paragraph style "Body" 
		set theHead to paragraph style "Head" 

		tell text frame 1 
			tell parent story 
				repeat while (get character -1) = return 
					delete character -1 
				end repeat 
				set applied paragraph style of paragraphs to theBody 
				set applied paragraph style of paragraph 1 to theHead 
				set theOffset to offset of paragraph 2 
			end tell 
			set startTrack to -1 
			set endTrack to -20 
			repeat while (get overflows) is true 
				set tracking of parent story to startTrack 
				set startTrack to startTrack - 1 
				if startTrack = endTrack then 
					exit repeat 
				end if 
			end repeat 
			set startSize to 11 
			set endSize to 8 
			repeat while (get overflows) is true 
				set point size of text from character theOffset to character -1 of parent story to startSize 
				set startSize to startSize - 0.25 
				if startSize = endSize then 
					exit repeat 
				end if 
			end repeat 
		end tell 
	end tell 
end tell 

I would like to paste text from clipboard to existing frame in my document. I can do this if I first manually select my text frame by putting insertion point with text tool, but I like to know if this is possible to do automatically through AppleScript? Now this script pastes new frame to my document... 

Another thing, I got error message: InDesign 2.0.1 got an error: Can't make paragraph 2 of parent story of text frame 1 of document 1 into a text. 

on line: 

set theOffset to offset of paragraph 2 

What might be wrong? 

Kari
Technical Details
Message-ID: <ef9621b.-1@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-04!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!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,ab171db948cc8715,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-06-28 08:38:08 PST
From: "Kari Puikkonen" <kari.puikkonen@welho.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-04!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: As: Select text frame and paste from clipboard??
Message-ID: <ef9621b.-1@WebX.aaQKaf7vad4>
Date: Fri, 28 Jun 2002 08:07:47 -0700
Lines: 20
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit