I am getting a very basic problem while creating new document through applescript.
Please see the code below:
tell application "QuarkXPress"
activate
set templateName to make new document at beginning with properties {automatic text box:false, bottom margin:"3p", facing pages:true, horizontal measure:points, inside margin:"3p", outside margin:"3p", page height:"99p", page width:"70p", top margin:"3p", vertical measure:points, view scale:"100%"}
end tell
The Error I am getting “QuarkXpress got an error: Can’t set some object to {}. Access not allowed”.
Then I tried with TRY and it works, but I want to know is there any wrong in the code.
i get the “facing pages” bit as throwing up the error. would something like this work:
tell application "QuarkXPress"
activate
set templateName to make new document at beginning with properties {automatic text box:false, bottom margin:"3p", horizontal measure:points, inside margin:"3p", outside margin:"3p", page height:"99p", page width:"70p", top margin:"3p", vertical measure:points, view scale:"100%"}
tell default document 1
set facing pages to true
end tell
end tell
I’ve never needed to use facing pages, so don 't know if this is what you want.
but give this a go.
tell application "QuarkXPress Passport"
activate
set templateName to make new document at beginning with properties {automatic text box:false, bottom margin:"3p", horizontal measure:points, inside margin:"3p", outside margin:"3p", page height:"99p", page width:"70p", top margin:"3p", vertical measure:points, view scale:"100%"}
make new page at beginning of spread 1 of templateName
end tell
or is this a facing page:
tell application "QuarkXPress Passport"
activate
set templateName to make new document at beginning with properties {automatic text box:false, bottom margin:"3p", horizontal measure:points, inside margin:"3p", outside margin:"3p", page height:"99p", page width:"70p", top margin:"3p", vertical measure:points, view scale:"100%"}
repeat 3 times
make new page at end of templateName
end repeat
end tell
The problem is if we don’t define whether the facing pages is true or false in the script, then Quark just get the info from previous setting.
For instance, you may manually create a new document, check the “facing pages” option and press “OK”. Then run your scripts and you will find that the newly created document by the script will be in facing pages.
Vice versa, if you first manually create a new document, uncheck the “facing pages” option now and press “OK”. Then run the same scripts and you will find that the newly created document by the script will be in single pages.
Forgive me if I couldn’t express my problem clearly, but what I am looking for is something can be control by the script so that it wouldn’t produce inconsistant result from the previous settings.
You want to be talking to the right object. In Quark that would be default document 1.
tell application "QuarkXPress"
activate
tell default document 1
set guides showing to true
set guides in front to true
set horizontal measure to points
set vertical measure to points
set page height to "99p"
set page width to "70p"
set left margin to "3p"
set right margin to "3p"
set top margin to "3p"
set bottom margin to "3p"
set facing pages to true
set automatic text box to false
set view scale to 100
end tell
make document at beginning
tell document 1
-- do stuff here
end tell
end tell