I am trying to create a script to delete all the existing guides on a given Quark project. The script is based on one I wrote which creates guides in specific places where I want them. The original script works fine. The new one doesn’t. FYI: We work with files which are created by people outside our organization, which frequently have a lot of useless guides in place. I want to delete all of these, then run my other script to create the guides I need. I’ve got the second part working. Using the code below, the commands to bring the guides to from , to unhide, etc., work fine. Only the delete part doesn’t work. Note: The “tell current spread” portion of the script acts like it is being skipped - there is no notice of it in the event log. I expected that putting it in a try statement would provide some feedback if it failed. If anyone can help me with this, I would appreciate it.
(* This script written by Jonathan Gardner, © Gardner Designs, 2008. *)
tell application "QuarkXPress"
activate
if (exists project 1) is false then
beep
activate
display dialog "A QuarkXPress project must be open for this script to work." buttons "OK!" default button 1 with icon 2
else
try
tell document 1
set guides showing to true
set guides in front to true
set lock guides to false
set horizontal guides to deletable
set vertical guides to deletable
--------
tell current spread
ignoring application responses
try
delete every vertical guide
delete every horizontal guide
on error the error_message number the error_number
display dialog "The delete attempt failed -" & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
end try
end ignoring
end tell
--------
end tell
end try
with timeout of 11 seconds
activate
display dialog "Your guides have been deleted." buttons "Thanks!" default button 1 giving up after 10
end timeout
end if
end tell