🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #14821

[AS to JS] Reference script

#14821
From: Jens_Reineking
Date: Tue, 13 Jan 2004 12:42
28 lines
1727 bytes
I found an AppleScript for ID2 on the web which does help with simple page references. Since I'm working with IDCS and Win2000, I tried to convert it, but without success.

I should work the following way:
- Set up a hyperlink destination (text anchor).
- Write 'See page NN'
- Mark NN, set up a hyperlink pointing to your destination; the name of the hyperlink has to start with 'pageref'.
- Run the script to replace NN with the correct page number.
- Re-Run the script if the pages change

Any help with this specific script as well as some general pointers on how to rewrite AS to JS and for rewriting scripts for IDCS would be greatly appreciated.

Jens

Original AppleScript:
tell application "InDesign 2.0.1"
	set doc to active document
	tell doc
		set numlinks to count hyperlinks
		repeat with i from 1 to numlinks
			set hl to hyperlink i
			set s to name of hl
			if word 1 of s = "pageref" then
				set t to source text of source of hl
				set contents of t to name of parent of parent text frame of destination text of destination of hl
			end if
		end repeat
	end tell
end tell
Technical Details
Message-ID: <2ccf57a5.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!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,d2827867f6cc8388,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2004-01-13 05:07:41 PST
From: Jens_Reineking@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: [AS to JS] Reference script
Message-ID: <2ccf57a5.-1@webx.la2eafNXanI>
Date: Tue, 13 Jan 2004 04:42:30 -0800
Lines: 34
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit