(Rookie) Can I get a hand here? (QX script question)

Hi there; new guy, trying to put a space before every character that is superior.
Can anyone tell me why the script below isn’t working?

tell application “QuarkXPress™ 4.11”
activate
tell story 1 of every text box of document 1
try --Put a space before all superior text–
copy " " to before (every text style range whose style contains {superior})
end try
end tell
end tell

And where would I find a list of how AppleScript refers to invisible characters, like spaces, tabs, soft returns, etc.?

I don’t have Quark, and I’m not familiar with it, but I have a question. What is the result of:

tell application "QuarkXPress™ 4.11"
	activate
	tell story 1 of every text box of document 1
		try --Put a space before all superior text--
			-- copy " " to before (every text style range whose style contains {superior})
      set x to (every text style range whose style contains {superior})
		end try
	end tell
end tell
x

I’d check the AppleScript Language Guide first.

AppleScript is sometimes too easy. If you run this and then check the result window in the script editor, you’ll see what I mean.

set x to "I like AppleScript because:" & return & return & tab & tab ¬
	& "It's fun." & return & tab & tab & "It's easy." & return & tab & tab & ¬
	"People at the MacScripter BBS are always willing to help." & return & tab & tab ¬
	& "I've learned that" & space & "that AppleScript is" & space & "very English-like."

.

You can also use ASCII numbers and characters.

set x to ASCII number of space

set y to "I like" & (ASCII character x) & "AppleScript."
display dialog y

The result of:
Code:
tell application “QuarkXPress™ 4.11”
activate
tell story 1 of every text box of document 1
try --Put a space before all superior text–
– copy " " to before (every text style range whose style contains {superior})
set x to (every text style range whose style contains {superior})
end try
end tell
end tell
x
Nothing different when I ran it. Don’t I need (and pardon my ignorance if I misuse terminology here, but some kind of loop statement, like run i times, or something to that effect?

I didn’t ask if it was different, I asked for the result (unstated earlier: as displayed in the result window of Script Editor). :stuck_out_tongue:

And yes, you might need a repeat loop. I don’t know what a ‘text style range’ is, so I was hoping you would show me so I could guess at the code. I reckon someone with Quark experience would be more qualified to help you. :slight_smile:

set Rob to "shut up"

Gotcha. Here’ s the result:

{“d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”, “d”, “1”, “2”}

Thanks for helping, anyhow.