How to change a particular char in particular font into a tag

My need is just want to replace the character “1” which is in the font “MathematicalPi 1” to a tag “<>”.\

I found the solution partially and i change the character “1” to tag if the character arrives lonely but if the character arrives within middle of a word i couldn’t change and it throws an error.

Script

tell application "QuarkXPress Passport"
	tell document 1
		set FontNames to {}
		set myFontList to (get font list)
		
		repeat with eachItem in myFontList
			set FontNames to FontNames & name of eachItem
		end repeat
		
	end tell
	
	if "MathematicalPi 1" is in FontNames then
		tell every story of document 1
			try
set (every text style range whose font is "MathematicalPi 1" and character 1  is "1") to ""
			on error errMsg
				display dialog errMsg
			end try
		end tell
	end if
end tell

Error
QuarkXPress Passport got an error: Can’t set every text style range of every story of document 1 whose font = "MathematicalPi 1" and character 1 = "1" to ""

Anyone plese help me to solve this -San

Model: QuarkXPress 6.52
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Try this instead:


tell application " QuarkXPressâ„¢"
	tell document 1
		set FontNames to {}
		set myFontList to (get font list)
		
		repeat with eachItem in myFontList
			set FontNames to FontNames & name of eachItem
		end repeat
		
	end tell
	
	if "MathematicalPi 1" is in FontNames then
		set allstories to object reference of every story of document 1
		repeat with astory in allstories
			try
				tell astory
					set (every text style range whose font is "MathematicalPi 1" and character 1 is "1") to ""
				end tell
			end try
		end repeat
	end if
end tell

Scripting QXP all day long… :smiley:

Dear Martin,

Still i got the error


-san

Here it works just fine using the code mentioned above. Which QXP version are you running?

QuarkXPress 6.52

The same one is also run in my system if the specified character is first character…

if the the specified character is in middle of word it throws an error.

My need is to change that specfied character in any part of the document with any face…