So here is my issue, I have an employee who uploads artwork done in illustrator that needs printed to a large format printer, most of the time the document is set to a tabloid size (because the art is big) . I need to figure out how to automate the printing of these files via applescript and folder actions. Here is the problem, from what I understand the scripting of the page setup (letter, leagl, tabloid) is not possible. The default is letter and anything bigger than that will be cut off. There has to be a way. Any advice.
If you are automating the process, and just need a print of the final art without worrying about the scale of the printed image than it would probably be best to build an InDesign document, add a label for the file information and print from there.
You should be able to tell your script the “print area” (i.e. “artboard bounds”, “artwork bounds”, "crop area"etc…)
have a look under job options under the print suite in illustrator dictionary.
The size of the document in illustrator shouldn’t really be a problem with printing.
What version of illustrator are you using?
I think you need to be using a variation on this in your script
tell application "Illustrator CS"
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
OK so I have given up on scripting the doc setup and have just instructed the employee to make sure everything is saved into the file. THanks everyone for the input. Since then I have adapted the folder actions script to open and print the files as they are addded to the specified folder… But of course I have an Issue I cannnot resolve. This script works fine for one file at a time. But when multiple files are added to the folder it goes crazy. Any advice?
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
--create the alert string
set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
if the item_count is greater than 1 then
set alert_message to alert_message & (the item_count as text) & " new items have "
else
set alert_message to alert_message & "One new item has "
end if
set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
display dialog the alert_message 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"
--go to the desktop
activate
--open the folder
open this_folder
--select the items
reveal the added_items
end tell
end if
tell application "Finder"
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 added_items with options {«class pCLT»:true}
close added_items without dialog
print added_items
end tell
else if theAnswer is "Cancel" then
tell application "Finder"
display dialog "OK"
end tell
end if
end tell
end try
end adding folder items to
This is the default “add-new item alert.scpt” with added verbage to get it to print.
A repeat loop would help with multiple items. It would handle files one at a time, so you’d need to change your script a bit - a couple of “added_items” would need to be “an_item” and the dialog wording would be a little different.
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
on adding folder items to this_folder after receiving added_items
repeat with an_item in added_items
(* Your script *)
end repeat
end adding folder items to
I dont know what im doing obviouslly I really appreciate the help but I still cant get this to work.
Should I have the script make a list of the new files added and define variables to each new file.
I just dont get the whole list thing. Here is what I have. Thanks again
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
on adding folder items to this_folder after receiving added_items
repeat with an_item in added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
--create the alert string
set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
if the item_count is greater than 1 then
set alert_message to alert_message & (the item_count as text) & " new items have "
else
set alert_message to alert_message & "One new item has "
end if
set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
display dialog the alert_message 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"
--go to the desktop
activate
--open the folder
open this_folder
--select the items
reveal the added_items
end tell
end if
tell application "Finder"
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 repeat
end adding folder items to
Here is an example of how to create a list and repeat through it. It only gets the name, not the alias - I don’t have a lot of time right now - but you could compare the name to a list of aliases because an alias contains a name.
on adding folder items to this_folder after receiving these_items
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
end adding folder items to
Once the aliases are sorted out, you can make your script work the way you want.
Is there a chance that items will be added to the folder while the action is running? That would mean more scripting.
In my previous post, I meant (although I see I didn’t state it clearly) that your script would need to be changed and a couple of “added_items” would need to be “an_item” and the dialog wording would need to be a little different.
This skips a lot of your script (I just commeneted out parts) because I don’t have time to work the above repeat into your script but it should work for now. I think. I didn’t test it.
property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
on adding folder items to this_folder after receiving added_items
repeat with an_item in added_items
try
tell application "Finder"
--get the name of the folder
--set the folder_name to the name of this_folder
--end tell
-- find out how many new items have been placed in the folder
--set the item_count to the number of items in the added_items
--create the alert string
--set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
--if the item_count is greater than 1 then
--set alert_message to alert_message & (the item_count as text) & " new items have "
--else
--set alert_message to alert_message & "One new item has "
--end if
--set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
--set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
--display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
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 --new line
set the user_choice to the button returned of the result
if user_choice is "Yes" then
--tell application "Finder"
--go to the desktop
activate
--open the folder
--open this_folder
--select the items
--reveal the added_items
reveal an_item --new line
--end tell
end if
--tell application "Finder"
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 repeat
end adding folder items to
If you come up with anything, please let me know. I’m probably going to spend some quality time with Adobe’s implementation of JavaScript and see if I can force the issue. So far AppleScript and UI scripting seem like dead-ends where Illustrator is concerned.
I noticed one suggestion was putting the Illustrator file into InDesign. As someone whose day job is supporting Illustrator and InDesign for a team for 40+ stations I can that introduces some headaches where color as well as PostScript are concerned. Repeat after me: “the more you nest, the more problems you ask for.”
Ah cool…I have that. What page? I did a search in the PDF and turned-up nothing. Only found references to the Coordinates and Paper Properties and a couple other things mentioned over in the thread I referenced. None of the properties seem specifically tied to something like “{page size: tabloid}” or in my case, I’d want “{page size: Custom}”.
If you can give me a page reference I’ll summarize if it’s something I covered with PreTech in the other thread, or I’ll let you know if it’s something new and applies/works.
Page 149. I’m not sure which version of ill you are using. Is it CS2? This type of reference stuff makes me totally insane, you would think they would give an example of how to incorporate these values into the script (for beginner sake):mad::mad: OK count to 10 relax… I dont know how all you programmers deal with this. Its been discribed to me as a love / hate thing…I guess I can see that:|:/