Yeah sorry, in the other thread PreTech and I have been through the whole Print Options thing, no dice. What he and I both noticed is there is no way to get it to do anything except letter-sized paper. I then realized there doesn’t seem to be a way to set the paper (either Custom or sizes pre-defined by the driver) via scripting. Which means any script will be “stuck” with whatever page size was last used outside the script.
I went to try JavaScript but the commands are the same. :-/
Currently trying to UI script the print dialog, but the results have been just as brain-busting:
Thank you so much for helping with the list. This really helps me to understand…
This is the next issue I have to deal with. Here is the final print script I’m assuming I need some sort of error handler in here, Once again any help is much appreciated.
set theList to {}
repeat with an_item in these_items
set end of theList to name of (info for an_item) as string
end repeat
repeat with listItem in theList
--display dialog listItem
end repeat
tell application "Adobe Illustrator 10"
--set user interaction level to never interact
activate
repeat with an_item in these_items
set end of theList to name of (info for an_item) as string
open an_item --with options {update legacy text:true}
delay 1
print document 1 without dialog
close document 1 saving no
end repeat
end tell
end adding folder items to
Are you eliminating the dialogs from your script? If so, you won’t need the names of the files:
on adding folder items to this_folder after receiving these_items
repeat with an_item in these_items
tell application "Adobe Illustrator 10"
--set user interaction level to never interact
activate
open an_item --with options {update legacy text:true}
delay 1
print document 1 without dialog
close document 1 saving no
end repeat
end tell
end adding folder items to
If you want to retain the dialogs, then you could use something like this, which was quickly cobbled together, and I don’t have Illustrator so can’t test it, but it should at least get the idea across.
on adding folder items to this_folder after receiving these_items
set name_list to {}
set alias_list to {}
repeat with the_item in these_items
set end of name_list to name of (info for the_item) as string
set end of alias_list to the_item
end repeat
repeat with an_item in alias_list
if name of (info for an_item) is in name_list then
try
tell application "Finder"
display dialog "A new item has been added, would you like to view it?" buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
set the user_choice to the button returned of the result
if user_choice is "Yes" then
tell application "Finder"
reveal an_item
--end tell
end if
set theAnswer to the button returned of (display dialog "do you want to print this file" buttons {"OK", "Cancel"} default button "OK")
if theAnswer is "OK" then
tell application "Adobe Illustrator 10"
activate
open an_item with options {«class pCLT»:true}
print an_item
close an_item without dialog
---set |job Options| to {class:job options, --print area:artwork bounds}
---set |print Options| to {class:print options, --job settings:|job Options|}
--print current document options |print --Options| without dialog
--end tell
else if theAnswer is "Cancel" then
tell application "Finder"
display dialog "OK"
end tell
end if
end tell
end try
end if
end repeat
end adding folder items to
I haven’t thought about error checking yet, but the house just got very quiet - which means I need to find out if the little ones have decided to nap or vandalize. Stay-at-home dads never have a dull day.
This is the first time I have read through your whole process. You referenced Illustrator CS2 in one of your messages, but in your script you are using Illustrator 10. The part of the line
open an_item with options {«class pCLT»:true}
(«class pCLT») suggests that you’re using Illustrator CS or CS2 terminology that isn’t available for Illustrator 10. The differences in scripting Illustrator 10 and CS are fairly big. Unfortunately, I’m at home right now and do not have access to Illustrator 10 to help with this part so the only thing I can suggest is opening 10’s dictionary and see how it references files to be opened. I don’t know if you have already looked for it or not, but in the application folder for 10 there’s hopefully a scripting guide. If you are actually using CS 2 then you need to change your line where you say:
tell application "Adobe Illustrator 10"
to
tell application "Illustrator CS2"
PreTech
P.S. If you have Ill 10 and CS or CS2 and you’re scripting for CS(2) while 10 is open (and CS closed), it will change your application reference to Ill 10. Don’t know why this is, but it is. I’ve tried several ways to get around this, but without a whole lot of luck. Also if you have compiled your script for CS(2) and it is closed when you open your script but 10 is open, the application it will use is 10 (the app references change from CS to 10).