Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

greedist

macrumors newbie
Original poster
Jul 7, 2021
16
0
/Users/abs2634/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/CMYK/CMYK.png

I want to print a file in that path using AppleScript.
 
Last edited:

Red Menace

macrumors 6502a
May 29, 2011
583
230
Colorado, USA
AppleScript itself can’t print anything, you will need to use an application such as Finder or Preview. Note that the print command wants an alias, so if you want POSIX you will need to coerce to a POSIX file:

AppleScript:
tell application "Finder" to print (choose file) -- print to default printer

-- or --

tell application "Finder" to print ("/Users/abs2634/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/CMYK/CMYK.png" as POSIX file)
 

greedist

macrumors newbie
Original poster
Jul 7, 2021
16
0
Thank you so much for your help!
AppleScript itself can’t print anything, you will need to use an application such as Finder or Preview. Note that the print command wants an alias, so if you want POSIX you will need to coerce to a POSIX file:

AppleScript:
tell application "Finder" to print (choose file) -- print to default printer

-- or --

tell application "Finder" to print ("/Users/abs2634/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/CMYK/CMYK.png" as POSIX file)
Thank you so much for your help!
 

greedist

macrumors newbie
Original poster
Jul 7, 2021
16
0
AppleScript itself can’t print anything, you will need to use an application such as Finder or Preview. Note that the print command wants an alias, so if you want POSIX you will need to coerce to a POSIX file:

AppleScript:
tell application "Finder" to print (choose file) -- print to default printer

-- or --

tell application "Finder" to print ("/Users/abs2634/Library/Mobile Documents/iCloud~is~workflow~my~workflows/Documents/CMYK/CMYK.png" as POSIX file)
Excuse me, but I have one more question.
Could you tell me a script that runs the script and ends the preview when the preview doesn't turn off?
 

greedist

macrumors newbie
Original poster
Jul 7, 2021
16
0
Thank you so much for your response and have a happy day!:)
 

greedist

macrumors newbie
Original poster
Jul 7, 2021
16
0
You can just tell Preview (or whatever application) to close the front window (or quit), for example:

AppleScript:
tell application "Preview" to close front window
Thank you so much for your response and have a happy day! :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.