修订版 | d137f64307e8ab6717361de03771b4f893bab832 (tree) |
---|---|
时间 | 2014-07-21 18:13:16 |
作者 | edktsnr <edktsnr@yaho...> |
Commiter | edktsnr |
1st commit
@@ -0,0 +1,146 @@ | ||
1 | +(* | |
2 | + | |
3 | + 2014-07-21 v0.1 リリース | |
4 | + | |
5 | + | |
6 | +*) | |
7 | + | |
8 | + | |
9 | + | |
10 | +property Photoshop : "" | |
11 | + | |
12 | +on run | |
13 | + | |
14 | + my choose_app("ph") | |
15 | + | |
16 | +end run | |
17 | + | |
18 | +on open theList | |
19 | + repeat with aFile in theList | |
20 | + my main(aFile) | |
21 | + end repeat | |
22 | +end open | |
23 | + | |
24 | + | |
25 | +on main(aFile) | |
26 | + set posix_aFile to POSIX path of aFile | |
27 | + set shellcmd to "ExifTool -T -Creator " & quoted form of posix_aFile --creatorバージョン取得 | |
28 | + set apl to do shell script shellcmd | |
29 | + | |
30 | + | |
31 | + if (offset of "Photoshop" in apl) is not 0 then | |
32 | + my launch_Ph(aFile) | |
33 | + else if (offset of "Illustrator" in apl) is not 0 then | |
34 | + my launch_ill(aFile, apl) | |
35 | + else | |
36 | + tell application "Finder" | |
37 | + set aExt to name extension of (info for aFile) | |
38 | + | |
39 | + if aExt is "psd" or aExt is "jpg" or aExt is "tif" then | |
40 | + my launch_Ph(aFile) | |
41 | + end if | |
42 | + end tell | |
43 | + end if | |
44 | +end main | |
45 | + | |
46 | + | |
47 | +--Photoshop 起動 | |
48 | +on launch_Ph(aFile) | |
49 | + | |
50 | + if Photoshop is "" then my choose_app("ph") | |
51 | + | |
52 | + tell application Photoshop | |
53 | + activate | |
54 | + open aFile | |
55 | + end tell | |
56 | +end launch_Ph | |
57 | + | |
58 | + | |
59 | +--Illustrator 起動 | |
60 | +on launch_ill(aFile, apl) | |
61 | + | |
62 | + set ver to my get_ver(aFile, apl) --バージョン取得 | |
63 | + my opne_file(aFile, ver) --取得バージョンで開く | |
64 | + | |
65 | +end launch_ill | |
66 | + | |
67 | + | |
68 | +on get_ver(aFile, ver) | |
69 | + | |
70 | + set cc to 17 | |
71 | + set cs6 to 16 | |
72 | + set cs5 to 15 | |
73 | + set cs4 to 14 | |
74 | + set cs3 to 13 | |
75 | + | |
76 | + | |
77 | + if (offset of cc in ver) is not 0 then | |
78 | + --display dialog "CC" | |
79 | + set posix_aFile to POSIX path of aFile | |
80 | + set shellcmd to "ExifTool -T -Creatortool " & quoted form of posix_aFile | |
81 | + set ver_sub to do shell script shellcmd | |
82 | + if (offset of "2014" in ver_sub) is not 0 then | |
83 | + return "CC 2014" | |
84 | + else | |
85 | + return "CC" | |
86 | + end if | |
87 | + | |
88 | + else if (offset of cs6 in ver) is not 0 then | |
89 | + --display dialog "CS6" | |
90 | + return "CS6" | |
91 | + | |
92 | + else if (offset of cs5 in ver) is not 0 then | |
93 | + --display dialog "CS5" | |
94 | + set shellcmd to "ExifTool -T -Creatortool " & quoted form of posix_aFile | |
95 | + set ver_sub to do shell script shellcmd | |
96 | + if (offset of "2014" in ver_sub) is not 0 then | |
97 | + return "CS5.1" | |
98 | + else if (offset of "CS5.1" in ver_sub) is not 0 then | |
99 | + return "CS5.1" | |
100 | + else | |
101 | + return "CS5" | |
102 | + end if | |
103 | + | |
104 | + else if (offset of cs4 in ver) is not 0 then | |
105 | + --display dialog "CS4" | |
106 | + return "CS4" | |
107 | + | |
108 | + else if (offset of cs3 in ver) is not 0 then | |
109 | + --display dialog "CS3" | |
110 | + return "CS3" | |
111 | + | |
112 | + else | |
113 | + return "none" | |
114 | + end if | |
115 | +end get_ver | |
116 | + | |
117 | + | |
118 | +on opne_file(aFile, ver) | |
119 | + if ver is not "none" then | |
120 | + try | |
121 | + set open_app to (path to applications folder as Unicode text) & "Adobe Illustrator " & ver & ":Adobe Illustrator.app" | |
122 | + | |
123 | + tell application open_app | |
124 | + activate | |
125 | + open (aFile as alias) | |
126 | + end tell | |
127 | + on error | |
128 | + my choose_app("Ill") | |
129 | + --display dialog "ver." & ver & " はこのMacにはインストールされていないようです" buttons " OK " default button 1 giving up after 3 | |
130 | + end try | |
131 | + end if | |
132 | +end opne_file | |
133 | + | |
134 | + | |
135 | +on choose_app(apl) | |
136 | + if apl is "ph" then | |
137 | + set msg to "Adobe Photoshopを指定してください。" | |
138 | + else | |
139 | + set msg to "Adobe Illustratorを指定してください。" | |
140 | + end if | |
141 | + | |
142 | + set tmp to choose file with prompt msg default location path to applications folder | |
143 | + if tmp is not "" and apl is "ph" then | |
144 | + set Photoshop to tmp as Unicode text | |
145 | + end if | |
146 | +end choose_app |
@@ -0,0 +1,29 @@ | ||
1 | + | |
2 | +--display dialog app_folder as string | |
3 | + | |
4 | +set launch_Photoshop to my launch_ph() as unicode text | |
5 | +--display dialog launch_Photoshop as string | |
6 | + | |
7 | +tell application launch_Photoshop --as Unicode text | |
8 | + activate | |
9 | +end tell | |
10 | + | |
11 | +--Macintosh HD:Applications:Adobe Photoshop CC 2014:Adobe Photoshop CC 2014.app: | |
12 | + | |
13 | +on launch_ph() | |
14 | + set app_folder to path to applications folder as Unicode text | |
15 | + | |
16 | + set ver_str to {"CS5", "CC 2014", "CC"} | |
17 | + -- set ver_str to {"CC 2014", "CC", "CS5"} | |
18 | + set ver_count to count of ver_str | |
19 | + | |
20 | + repeat with i from 1 to ver_count | |
21 | + set ver to "Adobe Photoshop " & item i of ver_str | |
22 | + try | |
23 | + set app_path to app_folder & ver & ":" & ver & ".app" as alias | |
24 | + return app_path | |
25 | + on error | |
26 | + -- | |
27 | + end try | |
28 | + end repeat | |
29 | +end launch_ph | |
\ No newline at end of file |