Quark frame bounds validate and write in report

Hi All,
I’m new in this forum, I need to write a script with below steps. Kindly help on this topic to go to the next level.

  1. Start current document
  2. Change basic measures
  3. Collect the bounds from every text frames
  4. Check round value and half of the round value (must 2 or 2.5 not in 2.35)
  5. If not round value then write in text file

I have stuck in get the value with string not write the value in effectively, please see the attachment.


tell application "QuarkXPress"
    tell document 1
        set filePath to (file path as string)
        set txf to filePath & "_log.txt"
        set myFile to open for access txf with write permission
        set page rule origin to {"0", "0"}
        set horizontal measure to millimeters
        set vertical measure to millimeters
        set myfr to every text box
        repeat with mytf in myfr
            set myY to top of bounds of mytf
            set myX to left of bounds of mytf
            write myX to myFile starting at eof
            write myY to myFile starting at eof
        end repeat
    end tell
    close access myFile
end tell

Kindly help to modify this code or let me know if any other method.

Thanks in advance,
Selva

Model: MacBook Pro
AppleScript: QuarkXpress 8
Browser: Safari 537.36
Operating System: Mac OS X (10.13 Developer Beta 3)

New code and error here:

tell application "QuarkXPress"
	tell document 1
		set filePath to (file path as string)
		set txf to filePath & "_log.txt"
		set myFile to open for access txf with write permission
		write "The below measures not in round:\n" to myFile
		set page rule origin to {"0", "0"}
		set horizontal measure to millimeters
		set vertical measure to millimeters
		set myXlist to {""}
		set myYlist to {""}
		try
			set myfr to every text box
			repeat with mytf in myfr
				set myY to top of bounds of mytf
				set myX to left of bounds of mytf
				set end of myXlist to myX
				set end of myYlist to myY
				--write myxx to myFile starting at eof
				--write myY to myFile starting at eof
			end repeat
		on error errMsg
			close access myFile
			display dialog errMsg
		end try
		write "X: " & [b]myXlist[/b] to myFile starting at eof-- error in this line with bold
		write "Y: " & myYlist to myFile starting at eof
	end tell
	try
		close access myFile
	end try
end tell

Already discussed the same in below link and not final, guide to addition

http://macscripter.net/viewtopic.php?id=17036

Hi Selva. Welcome to MacScripter.

I don’t have QuarkXpress and don’t know anything about scripting it, but it does look as if there’s some issue with Script XTensions either not being installed on your computer or not in the right place.

There are actually a couple of other issues with your script, neither of which is the immediate cause of your problem:

  1. The write "X: " and write "Y: " lines should be included in the ‘try’ statement above, so that the script doesn’t stop and leave you with an open file when the current error occurs. :wink:
  2. Concatenating a list to text — as in "X: " & myXlist — causes the list to be coerced to text first. The effect of list-to-text coercion is influenced by the state of AppleScript’s text item delimiters, so these should explicitly be set to “” first. Otherwise you may get other characters inserted between the items from the list in the final text.
tell application "QuarkXPress"
	tell document 1
		set filePath to (file path as string)
		set txf to filePath & "_log.txt"
		set myFile to open for access txf with write permission
		write "The below measures not in round:\n" to myFile
		set page rule origin to {"0", "0"}
		set horizontal measure to millimeters
		set vertical measure to millimeters
		set myXlist to {""}
		set myYlist to {""}
		try
			set myfr to every text box
			repeat with mytf in myfr
				set myY to top of bounds of mytf
				set myX to left of bounds of mytf
				set end of myXlist to myX
				set end of myYlist to myY
				--write myxx to myFile starting at eof
				--write myY to myFile starting at eof
			end repeat
			-- Write to the open file within this 'try' block.
			-- And explicitly set AppleScript's text item delimiters to "" for the list-to-text coercions.
			set astid to AppleScript's text item delimiters
			set applescript's text item delimiters to ""
			write "X: " & [b]myXlist[/b] to myFile starting at eof-- error in this line with bold
			write "Y: " & myYlist to myFile starting at eof
			set AppleScript's text item delimiters to astid
		on error errMsg
			close access myFile
			set AppleScript's text item delimiters to astid
			display dialog errMsg
		end try
	end tell
	try
		close access myFile
	end try
end tell

Hi Nigel Garvey,

Thanks for the analysis, its very useful for this.

All: Now, we testing the application have related bug if any in my system. Can you please share anyone if faced same problem in the past?

Thanks,
Selva

Which version of XPress are you scripting here?