newbie: help labeling box to later transform to 100% in InDesign

I have a very complicated script I have been asked to edit.

I need to label every text box that contains the page title (paragraph style called “Slide Title”) but only on master pages “S-Slides”

This text box, grouped with everything else on the page later on in the script, will be transformed to 55%.

At the end of the script, when I ungroup all items on every page, I want to call up that label mentioned above, and transform that box back to 100%.

Nothing I have done seems to work. The original script is CRAZY long.
I have tried to:
set label of page item 1 of master spread “S-Slides” to “Slide Title”

then later on:
set transform reference point to top center anchor
set absolute horizontal scale of “Slide Title” to 100
set absolute vertical scale of “Slide Title” to 100

nothing happens so I assume the label isn’t being set correctly.

Hillary

Not certain of the problem from looking at just a few lines of your script, but I’m not sure you can reference a page item just by its label. Instead, I would do something like this:

set absolute horizontal scale of of page item whose label = “Slide Title” to 100

or

repeat with i from 1 to count of page items in document 1
if label of page item i of document 1 = “Slide Title” then
set absolute horizontal scale of page item i of document 1 to 100
end if
end repeat

I should have mentioned it’s only legacy code from a co-worker. It’s not for commercial use.

Thanks and I will try the suggestions.

Hillary

There are a number of issues that you need to deal with for the script to work the way I think you do.

The first is how ID handles scaling of the objects. If you are using ID CS3 there is a general preference “when scaling” that determines if the percentage is based off the original size or if it is adjusted to the new size (ie reset to 100% at the new size). If you are using CS2 or earlier this may not be an issue. What you need it set to is “adjust scaling percentage.” This will allow you to set the scaling to 55% and later reset it to 100%. In the snippet below I first save the start value of this to a variable and then set it to what we need for the script to work correctly. At the end I reset it to the start value so that ID behaves the way the user had it set when the script was launched.

The next problem that needs to be fixed is the transform reference point. This is a property of the layout window so we need reference that to set the value to where you want it.

Finally you need to have your references correct in your tell blocks to address the correct elements. I would suggest using text frame to refer to the text element so that you don’t accidentally set the title to another type of page element. The number may not be correct, it all depends on the stacking order and how many text frames are on the master page. Once the label is set you should be able to call it by name, but you need to tell indesign what type of object you are referencing, text frame “Slide Title” or page item “Slide Title.”

Since we set the “when scaling” preference above the original size will be 100. When you scale it to 55% the scaling of the object will be 55. Later you can reset it to 100. If you did not change the preference then you could still do this but would have to figure out the percentage you would need to enlarge it. For example if you reduced everything 50% you would need to enlarge it 200% to get it back to the original size.

tell application "Adobe InDesign CS3"

	set UserScaleOption to when scaling of transform preferences
	set when scaling of transform preferences to adjust scaling percentage
	
	set transform reference point of layout window 1 to top center anchor
	
	tell document 1
		tell master spread "S-Slides"
			set label of text frame 1 to "Slide Title"
			set horizontal scale of text frame "Slide Title" to 55
			set vertical scale of text frame "Slide Title" to 55
		end tell
	end tell
	
	set when scaling of transform preferences to UserScaleOption
	
end tell