Hello,
I have this script that works fine, as long as all the images are OK in quark.
For this next group of quark files that I want to use this for, there is a missing image, but it is a slug and insignificant to the PDF I am creating.
I have tried in the past, unsuccessfully to use a system event here.
With the help of you folks on this forum, we did get system events to work, but only if I used Quark 8.
This particular machine only has quark 7.5 and we need to work on this machine.
Here is the script below…if anyone can help me with a system event that would click OK to the missing images, I would greatly appreciate it.
Thanks so much
babs
on open filelist
set deskPath to path to desktop as Unicode text
tell application "Finder"
repeat with i from 1 to count of items of filelist
set theFile to item i of filelist
if not ((kind of theFile starts with "Quark") or (kind of theFile starts with "InDesign")) then
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 6
return
end if
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of theFile starts with "InDesign") then -- Process as InDesign
set fileName to name of theFile
my createInDesignPDF(theFile, deskPath, (text 1 thru -6 of fileName))
else -- Process as Quark
my createQuarkPDF(theFile)
end if
end repeat
end tell
end open
on createInDesignPDF(theFile, savePath, docName)
tell application "Adobe InDesign CS2"
open theFile
set theProps to properties of PDF export preset "[Smallest File Size]"
set newProps to {view PDF:false, page range:"all", crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (savePath & docName & ".pdf") without showing options
set properties of PDF export preferences to oldProps
close front document saving no
end tell
end createInDesignPDF
on createQuarkPDF(theFile)
tell application "QuarkXPress"
open theFile
activate application
end tell
tell application "System Events"
tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 5
click button "Save" of window "Export as PDF"
delay 5
end tell
end tell
tell application "QuarkXPress"
activate
close front document saving no
end tell
end createQuarkPDF
Does it help to suppress printout of any missing image to avoid the warning dialog altogether? (It’s in a ‘try’ block to avoid script error when there’s no missing images.)
on createQuarkPDF(theFile)
tell application "QuarkXPress"
open theFile
activate application
--suppress printing of any missing picture, if they exist
try
tell document 1 to set suppress printing of every image of (every picture box whose missing of image 1 is true) to true
end try
end tell
tell application "System Events"
tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 5
click button "Save" of window "Export as PDF"
delay 5
end tell
end tell
tell application "QuarkXPress"
activate
close front document saving no
end tell
end createQuarkPDF
Hey Pandrake!!!
Perfect, that did it
Sorry for the late reply…been running around like a nut!!!
Just tested it and it works fine…
Thank you so much!
babs
ok…I spoke a little too soon
The images are fine…I have two other weird things happening…
1-even though they are definitely quark files, sometimes it says, the file is not a quark file???
2-I have a Folder called PDF on my desktop…is there a way to make it go into that folder on the save…right now, I put an alias in my sidebar, but I have to pick it each time.
thanks!
babs
Ouch!
At least the missing picture hiccup was scared away…
- Very hard to diagnose why that might happen without access to both the environment and the files in question. How do you know they are definitely Quark files? If you double-click on it in the Finder, or use Quark’s File->Open. menu does the file open, and only fails when AppleScript tells Quark to open it? I ask because I suspect that while the Finder thinks it’s a Quark file (your file kind check in the ‘on open’ part of the script) it may not be, or it is and it’s corrupt. Or, you need a more thorough check of the file kind as ‘equals “QuarkXPress Project File”’ instead of ‘begins with “Quark”’ (it might be “Quark EPS” or something).
Also, a better and sometimes quicker check of file properties is to use Standard Addition’s ‘info for’ properties of a file, and check one of many attributes:
kind:“QuarkXPress Project File”
file type:“XPRJ”
file creator:“XPR3”
type identifier:“dyn.agk8zuycwmk” (that’s so weird I can’t stand it - but there it is)
If the file was saved from a Windows version of Quark, not all properties will be there, however (such as file type/creator).
- That’s going to be very tricky since you’re using GUI scripting to export as PDF, which means you’ll have to come up with a means of navigating the export’s Save dialog to also pick a location - such as choosing the alias in the side bar for you.
I know!!! Big Ouch
It is so bizarre…one of the computers is just fine, no message about not being a quark file —oh and trust me…they are all quark files ---- and at least the default location is her desktop. So, that’s just fine…she can move them when they finish batching.
My other co-worker however, defaults to the Macintosh HD, which our IT department doesn’t let us write to. So, I put a PDF folder on the desktop and then put it in the sidebar for easy access, but she has to pick it every time. In Quark, you can set a default save as location, but I can’t find anything for the Export to PDF… One way, I got rid of some of the errors about not being quark files, was to go into the finder preferences and make sure to check show all file extensions. That did help, but occasionally gave the message again. Very Random…
In any case, I will keep tinkering with it, and see if I can find anything. Although, I am now on vacation for the week, so I can’t test anything on my work computers…
so for now, thanks so much for the suggestions and To Be Continued
thanks!!!
babs