🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
3 messages
3 total messages Started by Ton Kuypers Sat, 11 May 2002 22:43
Removing XML-tags
#21042
Author: Ton Kuypers
Date: Sat, 11 May 2002 22:43
33 lines
1938 bytes
Please... somebody heeeeeeeelp.... What am I doing wrong??? 

I have an InDesign document with 9 frames on a page, all having XML-tags attached to it. After filling these frames with data I duplcate this spread and wat to remove the XML-tags from the first page... But even when using a single page and the following script, it stops with an error after item 6... 

The script:
 tell application "InDesign 2.0"
 	tell active document
 		repeat with i from 1 to the count of (every XML Element)
 			tell XML Element i
 				untag element
 			end tell
 		end repeat
 	end tell
 end tell
 

The result:
 tell application "InDesign 2.0"
 	count every XML Element of active document
 		--> 9
 	untag element XML Element 1 of active document
 	untag element XML Element 2 of active document
 	untag element XML Element 3 of active document
 	untag element XML Element 4 of active document
 	untag element XML Element 5 of active document
 	untag element XML Element 6 of active document
 		--> InDesign 2.0 got an error: XML Element 6 of active document kan niet worden opgevraagd. (can't be found???) 

What is going on, what am I doing wrong??? 

Many thanks in advance 

Ton
Re: Removing XML-tags
#21044
Author: Alan Stearns
Date: Mon, 13 May 2002 01:24
3 lines
1056 bytes
Once you've deleted 5 elements out of 9, there are only 4 left, so you get an error when you try to delete element 6.  You just need to iterate backwards: 

 repeat with i from the count of (every XML Element) to 1 by -1  tell XML Element i untag element end tell end repeat 
Re: Removing XML-tags
#21051
Author: Ton Kuypers
Date: Mon, 13 May 2002 19:11
5 lines
949 bytes
hmmmmm sounds sooooooo logical... must have been working to much, not being able to figure out this one... 

thanks 

Ton
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