Created
December 25, 2021 15:36
-
-
Save OKsign/1c019fc595b3065db2cc2f0778a74f36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import os | |
from datetime import datetime | |
utime = datetime.now() | |
utime2 = utime.strftime("%Y_%m_%d_%H.%M.%S") | |
output_file = '/Users/john/Desktop/output-combine_images_%s.png' % utime2 | |
script_file = '/Users/john/Desktop/ori.py' | |
column = 0 | |
cmd = """ | |
tell application "Finder" | |
set sel to selection | |
set selcount to count sel | |
end tell | |
if selcount is greater than 1 then | |
set list_imagefile to {} | |
repeat with i from 1 to selcount | |
copy (quoted form of POSIX path of (item i of sel as string)) & space to end of list_imagefile | |
end repeat | |
else | |
display dialog "Image File Must Be Selected More Than One" with title "Alert" | |
return | |
end if | |
set list_imagefile to list_imagefile as string | |
return list_imagefile | |
""" | |
aa = subprocess.run(['osascript', '-e', cmd],capture_output=True) | |
bb = aa.stdout | |
cc = bb.decode() | |
cmd1 = "python3 %s -c %s -o %s %s" % (script_file,column,output_file, cc) | |
os.system(cmd1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment