🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
3 messages
3 total messages Started by Michael_H._Davenport Thu, 26 Feb 2009 00:22
Make script work on current page AS
#924
Author: Michael_H._Davenport
Date: Thu, 26 Feb 2009 00:22
22 lines
2208 bytes
I've made the following script for adding a text object with the name of a linked item, but it only works when the item is on the first page of the document:

tell application "Adobe InDesign CS3"
	tell document 1
		try
			set linkName to (name of item link of all graphics of item 1 of selection)
		on error
			display dialog "Select a linked item to add its name." buttons {"Cancel"} default button 1
		end try
		set linkID to id of selection
		set geoBounds to geometric bounds of selection
		set nameYpos to ((item 3 of geoBounds) + 0.0625) as real
		set fullNameCount to number of characters of linkName
		set nameCount to (fullNameCount - 4)
		set linkNameNoSuffix to (characters 1 thru nameCount) of linkName as string
		set linkTextFrame to make text frame
		set avgXpos to ((item 4 of geoBounds) + (item 2 of geoBounds)) * 0.5
		if ((item 4 of geoBounds) - (item 2 of geoBounds)) < 2 then 			set geometric bounds of linkTextFrame to {nameYpos, avgXpos - 1, nameYpos + 0.25, avgXpos + 1} 		else 			set geometric bounds of linkTextFrame to {nameYpos, (item 2 of geoBounds), nameYpos + 0.25, (item 4 of geoBounds)} 		end if 		set contents of linkTextFrame to linkNameNoSuffix 		tell text frame 1 			tell paragraph 1 				set justification to center align 				set point size to 10 			end tell 		end tell 		set linkTextID to id of linkTextFrame 		set selection to {} 		set linkGroup to make group with properties {group items:{text frame id linkTextID, rectangle id linkID}} 		activate 	end tell end tell

Can anyone tell me how to get it to work on whatever page the selected linked item is on? Thanks in advance.

Mike D.
Re: Make script work on current page AS
#926
Author: Shane_Stanley
Date: Thu, 26 Feb 2009 01:24
9 lines
1403 bytes
Try:

set linkTextFrame to make text frame at beginning of active page of layout
window 1


-- 
Shane Stanley <sstanley@myriad-com.com.au>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>
Re: Make script work on current page AS
#852
Author: Michael_H._Davenport
Date: Thu, 26 Feb 2009 17:10
4 lines
973 bytes
Shane,
Thank you so much for the prompt reply. It worked after I took out the word "layout" (AppleScript saw it as a variable) and made some similar tweaks later in the script.
It sure can be aggravating to spend hours trying to figure out something that turns out to be so simple. Thank goodness for these forums and thanks again to you.
Mike D.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads