■ このスレッドは過去ログ倉庫に格納されています
AppleScript アップルスクリプト 質問、発表 6
- 1 :名称未設定:2013/12/21(土) 21:50:45.07 ID:1PJJFexL0.net
- 質問、発表どっちでもスレ。
■注意
安直なスクリプト作成依頼、丸投げ、「こういうの作ってください!」はお断り。
わからない点、エラーが解決できない点についてはスクリプト片を添えて質問すること。
OSバージョンも忘れずに。
■参考
AppleScript Language Guide
https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/
TN2065: do shell script
https://developer.apple.com/library/mac/technotes/tn2065/
AppleScript: The Language of Automation
http://www.macosxautomation.com/applescript/
MacWiki - AppleScript
http://macwiki.sourceforge.jp/wiki/index.php/AppleScript
鳶嶋工房 / AppleScript
http://tonbi.jp/AppleScript/
AS Hole(AppleScriptの穴)
http://piyocast.com/as/
■過去スレ
1 http://pc11.2ch.net/test/read.cgi/mac/1174045850/
2 http://pc11.2ch.net/test/read.cgi/mac/1197443062/
3 http://pc11.2ch.net/test/read.cgi/mac/1223026902/
4 http://anago.2ch.net/test/read.cgi/mac/1256127156/
5 http://anago.2ch.net/test/read.cgi/mac/1330350325/
- 791 :774:2016/08/23(火) 16:38:58.45 ID:6f9IVph50.net
- >>790
ありがとうございます!30余白が従来通りデスクトップ保存、二度目に教えたいただいた物を貼り付けましたが上手く動かず。。
「デスクトップに"padファイル名.jpg"がない」?とか言われます。。
- 792 :名称未設定:2016/08/23(火) 17:16:48.56 ID:w5kLaLoU0.net
- >>791
そりゃ入れる場所間違ってるんじゃない?
やってること理解すればどこでエラーが起きてるのかわかる。
- 793 :774:2016/08/23(火) 17:28:39.87 ID:6f9IVph50.net
- 以下にて原画→枠線1追加→枠線2追加→上書き保存で妥協しました。
できれば原画→枠線1追加→枠線2追加→同名でデスクトップに新規保存、がしたかった。。
on open dropObjects
tell application "Image Events" to launch
repeat with theDropItem in dropObjects
set theDropItemPOSIXPath to POSIX path of theDropItem
tell application "Finder"
set theDropItemName to name of theDropItem
end tell
tell application "Image Events"
set theImage to open theDropItem as alias
tell theImage
set theDimensionsList to dimensions
end tell
close theImage
end tell
set imageHeight to item 2 of theDimensionsList
set imageWidth to item 1 of theDimensionsList
set padImageHeight to imageHeight + 50
set padImageWidth to imageWidth + 50
- 794 :名称未設定:2016/08/23(火) 17:29:22.88 ID:6f9IVph50.net
- 続き・・
set scriptCommand to "sips " & (quoted form of theDropItemPOSIXPath)
& " -s formatOptions 100% -p " & padImageHeight & " " & padImageWidth & " --padColor
55555 "
do shell script scriptCommand
tell application "Image Events"
set theImage to open theDropItem as alias
tell theImage
set theDimensionsList to dimensions
end tell
close theImage
end tell
set imageHeight to item 2 of theDimensionsList
set imageWidth to item 1 of theDimensionsList
set padImageHeight to imageHeight + 5
set padImageWidth to imageWidth + 5
set scriptCommand to "sips " & (quoted form of theDropItemPOSIXPath)
& " -s formatOptions 100% -p " & padImageHeight & " " & padImageWidth & " --padColor
888888 "
do shell script scriptCommand
end repeat
end open
- 795 :名称未設定:2016/08/23(火) 17:44:26.75 ID:w5kLaLoU0.net
- 自分でアップしたものを、ちょこちょこ変更するから動かなくなる。
俺の書いた部分と自分の書いた部分の差異もわからないなら変に触らないほうがいいよ。
- 796 :名称未設定:2016/08/23(火) 17:47:21.30 ID:NoSsmXKJ0.net
- 高さと幅に奇数を加えるのがモニョモニョする
- 797 :名称未設定:2016/08/23(火) 23:44:36.69 ID:iI3N2afK0.net
- 全部 Image Events でやっちゃダメ?
on open drop_objects
repeat with drop_object in drop_objects
set drop_object to drop_object as string
tell application "Image Events"
repeat with item_modify_data in {{pad_margin:50, pad_color:{85 * 257, 85 * 257, 85 * 257}}, {pad_margin:6, pad_color:{153 * 257, 153 * 257, 153 * 257}}}
set this_image to open file drop_object
set the_dimensions to dimensions of this_image
pad this_image to dimensions {(item 1 of the_dimensions) + (pad_margin of item_modify_data), (item 2 of the_dimensions) + (pad_margin of item_modify_data)} with pad color pad_color of item_modify_data
save this_image
close this_image
end repeat
end tell
end repeat
end open
上書きしちゃうので元とっておきたいときは画像複製してからやってね
- 798 :774:2016/08/24(水) 12:20:13.50 ID:Eu4tDqDr0.net
- >>795
ありがとうございます、教えて頂いた一行を入れて動かせるようにトライします。
>>796
確かに偶数じゃないと気持ちが悪いですね、直します。。
>>797
ありがとうございます、こんなに短い命令文で書けるんですか。。
ここの最後に「デスクトップに同名ファイル名・形式で保存」ができるようにトライしてみます。
- 799 :名称未設定:2016/08/24(水) 12:23:44.02 ID:KUHn3SeV0.net
- 先にコピーしてから処理すればいいんじゃないの
- 800 :名称未設定:2016/08/29(月) 14:51:09.10 ID:hh1Ww9bW0.net
- ファイル名をコピー後に「A」を「B」に置換してからテキストを開いて貼り付け。
複数ファイルの場合は改行ではなくスペース区切りで貼り付けしてくれるスクリプト知ってたら教えてください!
総レス数 1008
389 KB
新着レスの表示
掲示板に戻る
全部
前100
次100
最新50
read.cgi ver 2014.07.20.01.SC 2014/07/20 D ★