I think your problem is to coerce the Quark data to something like string or real.
The data type of quarks page width is horizontal measurement.
Only Quark Xpress can handle this data type.
You must coerce the data. I don't knoe how to do it in Pythons AppScript
but her you have the code in AppleScript:
tell application "QuarkXPress" tell document 1 -- 1. Example ---- set pw to page width return pw -- "210 mm" return class of pw -- horizontal measurement
-- 2. Example ---- set pw to page width as real return pw -- 210.0 return class of pw -- real
My original AppleScript code uses the more generic coercion set pw to (page width as number) And should return the value in your preferred measurement system (the choice you set in Xpress Measurement preferences).
I suspect Xpress holds all its values in an independent namespace. You are able to change Quark's measurement preference at whim, and every dialog changes (almost) instantly to the new units. You are able to type any measurement units into any dialog box, width: 32mm height: 4.3in length: 5p6 Xpress will accept them and convert the result to your preferred units. You can even type mixed unit calculations into dialog boxes 319mm + 3" and the result will be in your preferred units.
But I haven't a clue where to find Quark's coercion method, or the keyword for number.
Any other suggestions for converting this AppleScript coercion into python?
tell application "QuarkXpress"
tell document 1
set pw to (page width as number)
pw.get(astype=k.Char) ## it doesn't like 'astype' or 'k.Char'
pw.get(type=appscript.k.inch_units) Unfortunately, using one of Quark's classes simply returns another <_AE.AEDesc object>
The trick of passing a coercion was a complete surprise.
That idea isn't really obvious from the very nice documentation for appscript.
Possibly it's just my poor comprehension?
Where did you obtain the 'astype' parameter?
I pulled 'type' out of my ass.
I am still hoping to spawn a more fruitful discussion of how to explore an app's interface using appscript.
But if we're complaining about having to be pre-cognizant of the most minute detail
for an App's implementation of AppleScript before being able to do anything with it;
I'd like to point out that being omniscient is a standard requirement for writing IN AppleScript.
To do the most simple thing, you must bang your head against the wall until you hit upon the secret. Either by
chance or by reading other people's discoveries. You're never, ever privy to the source. Don't even try to ask.
That's why everyone loves AppleScript ;p You have to think very, very different.
I am honestly amazed appscript works at all.
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig