I am trying to work with the bounds of my picture but there are in type I don’t recognize. I want them as real.
Can someone help me ?
set NewBox to make new graphic box at beginning with properties {bounds:({110, 0, 220, 46}), contents:none, color:null, frame:{color:"noir", style:solid, width:"1 pt"}, runaround:none runaround}
set box shape of NewBox to polygonal
set c to height of bounds of NewBox
set d to width of bounds of NewBox
set a to top of bounds of NewBox
set b to left of bounds of NewBox
return {a, b, c, d}
--results: {«data FXVM0137CF7A», «data FXHM00000000», «data FXVM0137CF7A», «data FXHM008264BA»}
I dont have Quark at home to test, and without the whole script with tell statements I can’t acuratly evaluate what is going on. My guess is that your return is outside of the Quark tell statement. Since the values returned from Quark for the bounds are Quark measurements the return doesnt know how to deal with the value set from Quark. You need to add “as real” to the end of your set statements for the variables a b c and d this way Quark will coerce the values into real numbers which can be used outside of the Quark tell block.
--Get bounds of box
set obnds to bounds as list
set boxtp to (coerce item 1 of obnds as millimeter units to real)
set boxlft to (coerce item 2 of obnds as millimeter units to real)
set boxbot to (coerce item 3 of obnds as millimeter units to real)
set boxri to (coerce item 4 of obnds as millimeter units to real)
I am writing a script to change the width of any text box that is more than 15p wide to 42p. I have almost everything I need working, except setting the width to a variable that is readable.
set FileSample to choose folder
set folderName to name of (info for FileSample)
tell application "Finder" to set theFiles to files of folder FileSample whose name extension is in {"qxd"} or kind contains "QuarkXPress" or file type is in {"XPRJ", "XPR3"} or creator type is in {"XPRJ", "XPR3"}
repeat with oneFile in theFiles
tell application "QuarkXPress"
activate
open (oneFile as alias) do auto picture import no use doc prefs yes remap fonts no
tell front document
set page rule origin to {"0", "0"}
set horizontal measure to picas
set vertical measure to picas
repeat with i from (count of group boxes) to 1
try
tell group box i
set grouped to false
end tell
end try
end repeat
repeat with i from 1 to count of text boxes
set boxWidth to ((get width of bounds of text box i) as real) as string --Errors here
if boxWidth is less than 15 then
tell text box i
(select)
set width of bounds to {42}
end tell
end if
end repeat
end tell
close saving yes
end tell
end repeat
The problem is I get this error:
Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger4
Browser: Firefox 3.0
Operating System: Mac OS X (10.5)
Did you ever solve this problem? I’m experiencing it with a project upgrading from Quark 7 to Quark 9. Suddenly the data coming from bounds won’t convert into real.
tell application “QuarkXpress”
return bottom of the bounds of text box 1 of document 1 as real
end
– result = can’t make «data FXVM00002400» into type real
Does this need to be done explicitly by the script? Is that a change in QXP 9? The app has a scripting dictionary, which past experience tells me means it has it’s stuff installed correctly. Perhaps not…?
Normally it is installed but it can be the wrong version. It coerces the data objects from Quark into AppleScript objects. The file can be found in the ‘/Library/Scripting Additions’ folder. Without the addition installed you will get those weird errors.
I also note that on a 10.5 running Quark 7, the scripting addition version is 7. I don’t know if that means the 9.0 machine has the wrong version or they haven’t changed it…? Anyone know this?
tell application "QuarkXPress"
tell document 1
tell page 1
tell text box 1
return top of bounds as point units as real -- From Quark sample script!
-- error "Can't make «data FXVM00005400» into type point units." number -1700 from «data FXVM00005400» to «class FXPT»
return top of bounds as real
-- error "Can't make «data FXVM00005400» into type real." number -1700 from «data FXVM00005400» to real
return top of bounds as number
-- error "Can't make «data FXVM00005400» into type number." number -1700 from «data FXVM00005400» to number
end tell
end tell
end tell
end tell
Funny this thread should light up again, since I’ve been having the issue again. I actually removed the QXPScriptingAdditions.osax from the Library/ScriptingAdditions folder. I’m using Quark 8, but simply disabling it resolved this issue for me, though the ScriptingAddition was 7.0. The script compiles and runs without issue now. Go figure. :rolleyes:
Model: MBP
AppleScript: 2.3
Browser: Firefox 12.0
Operating System: Mac OS X (10.5)