How to run a bit of photoshop from the command line on mac osx?

Added: Problem: script and photoshop are launched, but a bit is not executed in the jpg file to mark it.

Original: I automate the workflow using ruby ​​on mac osx. The goal is to transfer my ruby ​​script directory (containing images), it opens each one, checks the orientation and size and transfers the image to the appropriate drop of Photoshop based on this, and then uploads them to flickr.

At first I used the "system" to try to run a bit, because I thought it was an executable binary.

Of course, a drop requires photoshop to run, so I tried this:

system('open /Users/fullpath/watermark_landscape_W600 --args /Users/fullpath/y020_Pork_Terrine_Orange_Paste_Bread.JPG') 

LaunchServices clearly returns the correct application because Photoshop opens.

I turned on logging in Photoshop in the vain hope that he would tell me what drops and parameters were transferred to Photoshop when it was open, but the output is very low:

 2013-07-14 12:45:53 Photoshop launched 2013-07-14 12:47:06 Photoshop quit 

How can I verify that open passes the correct parameters to osx and photoshop? Is there a rack error log output that I can connect to?

+4
source share
1 answer

Answer: opens Photoshop and executes drops on the image: NOTE: "-args" is omitted:

 open -a /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Thanks to Frederick, who worked with pleasure !!

Conducted combinations:

Opens Photoshop:

 open /full_path/watermark_foodlab_landscape_W600 

Opens Photoshop and opens the image in preview mode:

 open /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Opens Photoshop:

 open -a /full_path/watermark_foodlab_landscape_W600 --args /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Opens Photoshop and opens the image in preview mode:

 open ./watermark_foodlab_landscape_W600 ./y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Opens Photoshop:

 open ./watermark_foodlab_landscape_W600 --args ./y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Cannot find application named './watermark_foodlab_landscape_W600'

 open -a ./watermark_foodlab_landscape_W600 ./y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Quick rain dance.,

NOTE: '--args' omitted: Opens Photoshop and performs droplets on the image:

 open -a /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG 

Rereading the manual page, it makes sense, but of course I did not interpret it like that! The right to sit in the sun and bathe in pint glory! (Sunday after all)

+1
source

Source: https://habr.com/ru/post/1491313/


All Articles