Check tracking value in INDesign

Hi All,

I have some inDesign file with different Tracking amount. I want to develop one script which can check the tracking amount. A dialog box should appear if with three button of “Cancel”, “Fix”, & “Continue”. If the user will click on fix it will set the tracking value, and if user will say continue, then it process next command.

See the code below:


tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		tell text defaults
			--			get tracking -- to 20
			--		set tracking to 0
			set ttTracking to 5
			if tracking > ttTracking then
				display dialog "Please choose one of the action" default answer "" buttons {"Cancel", "Fix", "Continue"}
			else
				display dialog "Tracking is perfect!!!!"
			end if
		end tell
		
	end tell
end tell


Thanks

Hi All,

Below code is working fine. But I am still away from my target. Some operator has track with 10, some where it track with 5 like that. Now I want to capture those and fix if possible.
May be you understand my problem.

I am trying to do it, but in mean time if any one can help me then it will help me a lot.


tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		tell text defaults
			set ttTracking to 5
			if tracking ≤ ttTracking then
				set dialog_reply to display dialog "Please choose one of the action" default answer "" buttons {"Cancel", "Fix", "Continue"}
				set selection_choice to text returned of dialog_reply as text
				if selection_choice is "Fix" then
					set tracking to 5
				end if
				if selection_choice is "Continue" then
					display dialog "Processing the file without tracking!!!"
				end if
			else
				display dialog "Tracking is perfect!!!!"
			end if
		end tell
		display dialog "OK"
	end tell
end tell

Thanks

Hi,

I am looking some inputs from you guys. Please let me know it is possible or not, so that I can save my time if it is not possible.

See code below, I am not able to get as string for the buttons value.


tell application "Adobe InDesign CS3"
	set DocName to the name of document 1
	tell document 1
		tell text defaults
			set ttTracking to 5
			if tracking ≤ ttTracking then
				set dialog_reply to display dialog "Please choose one of the action" buttons {"Cancel", "Fix", "Continue"}
				set selection_choice to text returned of dialog_reply as string
				if selection_choice is "Fix" then
					set tracking to 5
				end if
				if selection_choice is "Continue" then
					display dialog "Processing the file without tracking!!!"
				end if
			else
				display dialog "Tracking is perfect!!!!"
			end if
		end tell
		display dialog "OK"
	end tell
end tell

Thanks

You don’t need to change the value to a string, as you are obtaining the result of a button.

set dialog_reply to display dialog "Please choose one of the action" buttons {"Fix", "Continue", "Cancel"}
if button returned of dialog_reply is "Fix" then beep --or whatever

As far as the general purpose of your script, settting tracking, is your method functional? I haven’t been able to test your code, but I’m guessing that the CS3-specific “text default” may just set a standard for future text attributes, rather than alter existing text. If that bit isn’t working, I would just apply a paragraph style with your tracking values.

Ya, you are right.

But how can I check the tracking in the existing text. May be there is a chance from style sheet, but some time operator has done the manual tracking also.

Anyway thanks for the help and looking forward more inputs from you.

Thanks

Hi rajeev,

I think it is not possible to change the tracking done with the text.

Thanks
Pooja

There is a tracking property of text, the problem is how far down do you want to check it, but paragraph, line, word, character to character? I’ve seen some crazy things done with tracking, up to character to character tracking being different for each pair of letters in a word rather than using kerning to adjust them. I think the first thing you want to do is to set a limit to what tracking you want to check. An example would be:

tell application "Adobe InDesign CS2"
	tell document 1
		set thestory to story 1
		set trackvalue to tracking of line 5 of paragraph 2 of story 1
	end tell
end tell

If you have a story with 2 paragraphs, the first has a tracking value of -10, the second has a tracking value of -20 of the first two lines and 0 on the last two. The script will return a value of -10.0 for the first paragraph, but a value of 0 on the second. When asking for the value on one of the first two lines then you will get a value of -20. So if you have a word that is tracked more than that of the referenced paragraph or line then you will get the overall tracking value of the paragraph or line and not that of the individual words. Similarly if you set the tracking of a paragraph to a given value it will clear the word to word or line to line values and set them to the specified value:

tell application "Adobe InDesign CS2"
	tell document 1
		set thestory to story 1
		set tracking of paragraph 1 of story 1 to 0
	end tell
end tell

I hope that this helps.