AdobeAppleScript

MakePSUserConfig


私個人的には
新しいUIを使って行くようにした方が良いかな?と思うけど…


「MakePSUserConfig.scpt.zip」をダウンロード

(*
Photoshop CC2019(20.0)の「変形」仕様変更について
https://forums.adobe.com/docs/DOC-9522

上記URLに記載のある設定ファイルを作成する


*)

---ファイル名を定義
set theFileName to "PSUserConfig.txt" as text
log theFileName

---記述する設定値を定義
set thePrefText to "TransformProportionalScale 0" as text
log thePrefText

---ユーザーの初期設定フォルダまでを取得
set thePreferenceFolder to path to preferences folder from user domain
log thePreferenceFolder

---初期設定フォルダをUNIXパスに変換
set thePreferenceFolderPosixPath to POSIX path of thePreferenceFolder as text
log thePreferenceFolderPosixPath

---初期設定フォルダまでのUNIXパスを定義
set thePhotoshopPreferenceFolderPosixPath to ("" & thePreferenceFolderPosixPath & "Adobe Photoshop CC 2019 Settings/") as text
log thePhotoshopPreferenceFolderPosixPath

---Photoshop初期設定フォルダを作成
set theCommandCom to ("mkdir -p '" & thePhotoshopPreferenceFolderPosixPath & "'") as text
log theCommandCom
do shell script theCommandCom

---設定するファイルを作成する
set theCommandCom to ("touch '" & thePhotoshopPreferenceFolderPosixPath & theFileName & "'") as text
log theCommandCom
do shell script theCommandCom

---設定値ファイルを書き込む
set theCommandCom to ("echo \"" & thePrefText & "\" > '" & thePhotoshopPreferenceFolderPosixPath & theFileName & "'") as text
log theCommandCom
do shell script theCommandCom

---初期設定ファイルの場所を開く
tell application "Finder"
activate
set theCommandCom to ("open '" & thePhotoshopPreferenceFolderPosixPath & "'") as text
log theCommandCom
do shell script theCommandCom
end tell

log "初期設定ファイルを作成しました"


|

この手の出し方は結構好感

プロダクションだよね?(ページ物が多いのかな…)
https://www.tactsystem.co.jp


Website_image00290703_225626

https://www.tactsystem.co.jp/applescript/free_list.html

オマケ的ですが、『私達はこんな事出来ます』を
制作物以外で出して行くのは良いんじゃないかな?

中途の採用なんかで、興味のある人が来てくれそう…
(自動化への理解がある職場って、毎度ヤッツケ仕事な現場にいると気持ち動くもんね…笑)

この内容なら、ソース見せても良いような気がするけど…そこは、まぁ、会社だからね
ちゃんと、『もっと』な方は有料で…と商売もしてるし。
(割とこの手のアピールって言うのかな?私は好きだけど)

|

[Acrobat AppleScript]tsubasaさんのコメントへのレスポンス【別ファイル】

「Acro8_do_script.zip」をダウンロード

「Acro8_do_script.sitx」をダウンロード

こちらのファイルで試してみてください。

当方環境10.6x Acro8.2.2で正常に動作しています。

|

[PSDcs4]WEBおよびデバイス用に保存【少し直し】

こちら[LINK]新しいウィンドで開きますのスクリプトの少し直し版

やっぱりフォトショプの繰り返し処理等は
『バッチ』処理の方が
ファイルのオープン クローズが無いので
早い
ファイル名の処理も出来るので
AppleScriptsでチマチマやるより
アクション組んでバッチが基本だなぁ






on open DropObj

tell application "Adobe Photoshop CS4"
activate
end tell


tell application "Finder"
-----------------ファインダ アクティブ
activate
--------書き出し形式選択
set SetLabels to ¬
"[JPG quality60-120x]", ¬
"[JPG quality80-50]", ¬
"[JPG quality80]", ¬
"[JPGwMat]", ¬
"[PNG8]", ¬
"[PNG8wMat]", ¬
"[PNG24]", ¬
"[PNG24wMat]", ¬
"[PNG24trans]", ¬
"[GIF]", ¬
"[GIFwMat]", ¬
"[GIF128]"}
set SaveAns to choose from list SetLabels with prompt "フォーマットを選んでください" OK button name "実行する" with title "フォーマット選択"
set SaveForWebExportOptions to SaveAns as Unicode text



-----------------マットカラー指定
if (SaveForWebExportOptions is "[PNG8wMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)


else if (SaveForWebExportOptions is "[JPGwMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

else if (SaveForWebExportOptions is "[PNG24wMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

else if (SaveForWebExportOptions is "[GIFwMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

end if




--------------------------------------------------変数リセット
set fileFcount to 0 ----カウントアップ用の数値
set fileFcountNo to "" as Unicode text ----ファイル名用のカウント数字の文字列
set NameSelect to "" as Unicode text ----リネームするか?オリジナルを保持するか?の判別用
set MainFileName to "" as Unicode text ----メインのファイル名
set exeName to "" as Unicode text
set newexeName to "" as Unicode text
--------------------------------------------------ファイル名を指定するか?を選ぶ リネーム か オリジナル保持か
display dialog "メインのファイル名はどうしますか?" default answer "img" buttons {"Rename", "Original"} with icon 1 default button 1
if button returned of the result is "Original" then
set resultFileName to text returned of the result as Unicode text
set the NameSelect to "2" as Unicode text
else if button returned of the result is "Rename" then
set resultFileName to text returned of the result as Unicode text
set the NameSelect to "1" as Unicode text
end if
--------------------------------------------------繰り返しの始まり
repeat with ObjFiles in DropObj

------------------------------------------------パスを取得
set pathAliasDoc to ObjFiles as alias

--------------------------------------------------ファイル名を取得
set fileName to name of ObjFiles as string

------------------------------------------------パスを文字列に変換
set pathStringDoc to pathAliasDoc as string

------------------------------------------------拡張子を判定
set exeName to name extension of ObjFiles

--------------------------------------------------もしもダイアログで Original を選んだら
if NameSelect is "2" then
--------------------------------------------------ファイル名から拡張子を取り除きそのままファイル名とする
set MainFileName to my replace(fileName, "." & exeName, "") as Unicode text
--------------------------------------------------もしもダイアログで Rename を選んだら
else if NameSelect is "1" then
--------------------------------------------------ダイアログをファイル名として連番を付加してファイル名を作る
set fileFcount to fileFcount + 1
set fileFcountNo to my zero2(fileFcount)
set the MainFileName to the fileFcountNo & "_" & resultFileName as Unicode text
end if
set the fileFcountNo to "" as Unicode text
-------------------------------------------------フルパスからファイル名を抜いてディレクトリ名を作る
set pathStringDirName to my replace(pathStringDoc, fileName, "") as string


--------------------------------------------------Photoshop呼び出し
tell application "Adobe Photoshop CS4"
--------------------------------------------------アクティブ
activate
--------------------------------------------------ファイルを開く
open alias pathStringDoc without dialogs
--------------------------------------------------開いたファイルをactivDocとして定義
set activDoc to document 1
--------------------------------------------------カラースペースをRGB
if (mode of activDoc is not RGB) then
change mode activDoc to RGB
end if
--------------------------------------------------チャンネルを8bit
if (bits per channel of activDoc is sixteen) then
set bits per channel of activDoc to eight
end if
--------------------------------------------------ドキュメントのサイズを取得 整数に丸める
------------注意!PSDの初期設定に単位が依存します。mmならmmサイズ pixelならピクセル値を返します。
set docHeight to height of activDoc as integer
set docWidth to width of activDoc as integer

--------------------------------------------------解像度94ppiへ変更(解像度は自分サイズって事ですので変更してください)
resize image activDoc resolution 94 width docWidth height docHeight resample method bicubic smoother



if (SaveForWebExportOptions is "[JPG quality80]") then

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, quality:80 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no

else if (SaveForWebExportOptions is "[JPG quality60-120x]") then


if docWidthdocHeight then
set wResio to (120 / docWidth)
set docWidth to (120) div 1 as integer
set docHeight to (docHeight * wResio) div 1 as integer

else if docWidth < docHeight then
set hResio to (120 / docHeight)
set docHeight to (120) div 1 as integer
set docWidth to (docWidth * hResio) div 1 as integer


end if

resize image activDoc resolution 94 width docWidth height docHeight resample method bicubic smoother

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if


export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, quality:60 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no



else if (SaveForWebExportOptions is "[JPG quality80-50]") then

set docWidth to (docWidth * 0.5) div 1 as integer
set docHeight to (docHeight * 0.5) div 1 as integer

resize image activDoc resolution 94 width docWidth height docHeight resample method bicubic smoother

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if


export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, quality:80 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no

else if (SaveForWebExportOptions is "[JPGwMat]") then

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, quality:80 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no




else if (SaveForWebExportOptions is "[PNG8]") then

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:adaptive ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, png eight:true ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[PNG8wMat]") then

if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:adaptive ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, png eight:true ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no

else if (SaveForWebExportOptions is "[PNG24]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if


export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:false ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no

else if (SaveForWebExportOptions is "[PNG24wMat]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if


export document 1 in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, matte:{red:255, green:255, blue:255} ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:true ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no


else if (SaveForWebExportOptions is "[PNG24trans]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export document 1 in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:true ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no


else if (SaveForWebExportOptions is "[GIFwMat]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[GIF]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[GIF128]") then
if NameSelect is "2" then
set the webFileName to the (MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
else if NameSelect is "1" then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)
end if

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:128 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
end if
end tell
--------------------------------------------------にディレクトリ名とファイル名をつないでパスにしておく


--------------------------------------------------リセット
set docHeight to 0
set docWidth to 0
set exeName to "" as Unicode text
set newexeName to "" as Unicode text


end repeat
end tell
end open






--------------------------------------------------#ここからサブルーチン
to zero2(n)
if n < 10 then
return "00" & n
else if n < 100 then
return "0" & n
else
return n as text
end if
end zero2


to replace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end replace



------色のサブルーチン
on RGB8bitR({rColor, gColor, bColor})
set rColor to (rColor ^ 0.5) div 1
return rColor
end RGB8bitR

on RGB8bitG({rColor, gColor, bColor})
set gColor to (gColor ^ 0.5) div 1
return gColor
end RGB8bitG
on RGB8bitB({rColor, gColor, bColor})
set bColor to (bColor ^ 0.5) div 1
return bColor
end RGB8bitB


「save_for_web_v2.app.zip」をダウンロード[Download]新しいウィンドで開きます

| | コメント (0)

[PSDcs4]WEBおよびデバイス用に保存

CS4用に作りなおし

少し直したのがこちら[LINK]新しいウィンドで開きますにあります。


タイプを選択する所

マットの指定の所

連動していないので
設定を追加する場合は
マット指定の記述の追加が必要






on open DropObj

tell application "Adobe Photoshop CS4"
activate
end tell


tell application "Finder"
-----------------ファインダ アクティブ
activate
--------書き出し形式選択
set SetLabels to ¬
"[JPG quality80]", ¬
"[JPGwMat]", ¬
"[PNG8]", ¬
"[PNG8wMat]", ¬
"[PNG24]", ¬
"[PNG24wMat]", ¬
"[PNG24trans]", ¬
"[GIF]", ¬
"[GIFwMat]", ¬
"[GIF128]"}
set SaveAns to choose from list SetLabels with prompt "フォーマットを選んでください" OK button name "実行する" with title "フォーマット選択"

set SaveForWebExportOptions to SaveAns as Unicode text


-----------------マットカラー指定


if (SaveForWebExportOptions is "[PNG8wMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)


else if (SaveForWebExportOptions is "[JPGwMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

else if (SaveForWebExportOptions is "[PNG24wMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

else if (SaveForWebExportOptions is "[GIFwMat]") then
--------RGB16bitColor16bitRGB値を格納
set the RGB16bitColor to (choose color default color {255, 255, 255})
--------RGB8bitColor8bitに変換した値を格納
set the R8bitColor to my RGB8bitR(RGB16bitColor)
set the G8bitColor to my RGB8bitG(RGB16bitColor)
set the B8bitColor to my RGB8bitB(RGB16bitColor)

end if




--------------------------------------------------変数リセット
set fileFcount to 0 ----カウントアップ用の数値
set fileFcountNo to "" as Unicode text ----ファイル名用のカウント数字の文字列
set NameSelect to "" as Unicode text ----リネームするか?オリジナルを保持するか?の判別用
set MainFileName to "" as Unicode text ----メインのファイル名
set exeName to "" as Unicode text
set newexeName to "" as Unicode text
--------------------------------------------------ファイル名を指定するか?を選ぶ リネーム か オリジナル保持か
display dialog "メインのファイル名はどうしますか?" default answer "img" buttons {"Rename", "Original"} with icon 1 default button 1
if button returned of the result is "Original" then
set resultFileName to text returned of the result as Unicode text
set the NameSelect to "2" as Unicode text
else if button returned of the result is "Rename" then
set resultFileName to text returned of the result as Unicode text
set the NameSelect to "1" as Unicode text
end if
--------------------------------------------------繰り返しの始まり
repeat with ObjFiles in DropObj

------------------------------------------------パスを取得
set pathAliasDoc to ObjFiles as alias

--------------------------------------------------ファイル名を取得
set fileName to name of ObjFiles as string

------------------------------------------------パスを文字列に変換
set pathStringDoc to pathAliasDoc as string

------------------------------------------------拡張子を判定
set exeName to name extension of ObjFiles

--------------------------------------------------もしもダイアログで Original を選んだら
if NameSelect is "2" then
--------------------------------------------------ファイル名から拡張子を取り除きそのままファイル名とする
set MainFileName to my replace(fileName, "." & exeName, "") as Unicode text
--------------------------------------------------もしもダイアログで Rename を選んだら
else if NameSelect is "1" then
--------------------------------------------------ダイアログをファイル名として連番を付加してファイル名を作る
set fileFcount to fileFcount + 1
set fileFcountNo to my zero2(fileFcount)
set the MainFileName to the fileFcountNo & "_" & resultFileName as Unicode text
end if
set the fileFcountNo to "" as Unicode text
-------------------------------------------------フルパスからファイル名を抜いてディレクトリ名を作る
set pathStringDirName to my replace(pathStringDoc, fileName, "") as string


--------------------------------------------------Photoshop呼び出し
tell application "Adobe Photoshop CS4"
--------------------------------------------------アクティブ
activate
--------------------------------------------------ファイルを開く
open alias pathStringDoc without dialogs
--------------------------------------------------開いたファイルをactivDocとして定義
set activDoc to document 1
--------------------------------------------------カラースペースをRGB
if (mode of activDoc is not RGB) then
change mode activDoc to RGB
end if
--------------------------------------------------チャンネルを8bit
if (bits per channel of activDoc is sixteen) then
set bits per channel of activDoc to eight
end if
--------------------------------------------------ドキュメントのサイズを取得 整数に丸める
------------注意!PSDの初期設定に単位が依存します。mmならmmサイズ pixelならピクセル値を返します。
set docHeight to height of activDoc as integer
set docWidth to width of activDoc as integer

--------------------------------------------------解像度94ppiへ変更(解像度は自分サイズって事ですので変更してください)
resize image activDoc resolution 94 width docWidth height docHeight resample method bicubic smoother



if (SaveForWebExportOptions is "[JPG quality80]") then

set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, quality:80 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no


else if (SaveForWebExportOptions is "[JPGwMat]") then

set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "jpg") as string
set savewebFileName to (pathStringDirName & ":" & webFileName)

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, blur:0 ¬
, interlaced:false ¬
, lossy:0 ¬
, optimized size:true ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, quality:80 ¬
, web format:JPEG ¬
, web snap:0 ¬
, with profile:false ¬
} ¬
with copying

close activDoc saving no




else if (SaveForWebExportOptions is "[PNG8]") then

set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:adaptive ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, png eight:true ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[PNG8wMat]") then

set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:adaptive ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, png eight:true ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no

else if (SaveForWebExportOptions is "[PNG24]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string


export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:false ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no

else if (SaveForWebExportOptions is "[PNG24wMat]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string


export document 1 in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, matte:{red:255, green:255, blue:255} ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:true ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no


else if (SaveForWebExportOptions is "[PNG24trans]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "png") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string


export document 1 in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, interlaced:false ¬
, png eight:false ¬
, transparency:true ¬
, web format:PNG ¬
, web snap:0 ¬
} ¬
with copying

close document 1 saving no


else if (SaveForWebExportOptions is "[GIFwMat]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, matte:({red:R8bitColor, green:G8bitColor, blue:B8bitColor}) ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[GIF]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:256 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
else if (SaveForWebExportOptions is "[GIF128]") then
set the webFileName to the (the docWidth & "x" & docHeight & "_" & MainFileName & "." & "gif") as string
set savewebFileName to (pathStringDirName & ":" & webFileName) as string

export activDoc in file savewebFileName as save for web with options ¬
{class:save for web export options ¬
, color reduction:perceptual reduction ¬
, colors in palette:128 ¬
, dither:none ¬
, dither amount:100 ¬
, interlaced:false ¬
, lossy:0 ¬
, quality:0 ¬
, transparency:true ¬
, transparency amount:100 ¬
, transparency dither:none ¬
, web format:CompuServe GIF ¬
, web snap:0 ¬
} ¬
with copying
close document 1 saving no
end if
end tell
--------------------------------------------------にディレクトリ名とファイル名をつないでパスにしておく


--------------------------------------------------リセット
set docHeight to 0
set docWidth to 0
set exeName to "" as Unicode text
set newexeName to "" as Unicode text


end repeat
end tell
end open






--------------------------------------------------#ここからサブルーチン
to zero2(n)
if n < 10 then
return "00" & n
else if n < 100 then
return "0" & n
else
return n as text
end if
end zero2


to replace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end replace



------色のサブルーチン
on RGB8bitR({rColor, gColor, bColor})
set rColor to (rColor ^ 0.5) div 1
return rColor
end RGB8bitR

on RGB8bitG({rColor, gColor, bColor})
set gColor to (gColor ^ 0.5) div 1
return gColor
end RGB8bitG
on RGB8bitB({rColor, gColor, bColor})
set bColor to (bColor ^ 0.5) div 1
return bColor
end RGB8bitB

「save_for_web.html」をダウンロード[LINK]新しいウィンドで開きます

「save_for_web.app.zip」をダウンロード[Download]新しいウィンドで開きます


ドロップレット形式です。

ドロップの開始

タイプの選択
 ifマット指定有りなら マット色を指定

ファイル名の変更の有無

フォトショップで開いてWEB形式で保存

保存時のリネームor上書き

閉じる

繰り返し

な流れです。

参考にしてください

| | コメント (0)

[Ai]起動中のイラストレーターのバージョンを判定する

AppleScriptでイラストレーターのバージョンを判定
起動中のプロセスを見る
複数起動しているのは考えていない。..w

tell application "System Events"
set {allAppName} to {displayed name} of (every application process whose (visible is true) and (creator type is not "MACS"))

repeat with everyAppName from 1 to count of allAppName
try
if (item everyAppName of allAppName) is "Adobe Illustrator CS2" then
tell application "Finder"
activate
display dialog "CS2が起動中です"
end tell
end if
if (item everyAppName of allAppName) is "Adobe Illustrator CS3" then
tell application "Finder"
activate
display dialog "CS3が起動中です"
end tell
end if
if (item everyAppName of allAppName) is "Adobe Illustrator CS4" then
tell application "Finder"
activate
display dialog "CS4が起動中です"
end tell
end if
if (item everyAppName of allAppName) is "Adobe Illustrator CS5" then
tell application "Finder"
activate
display dialog "CS5"
end tell
end if

end try
end repeat
end tell

フォトショップ等他の
アドビクリエイティブ系ソフトにも応用が効きますね

 

「whats4Illustrator.scpt.zip」をダウンロード[Download]DownloadFile

「whats4Illustrator.rtf」をダウンロード[Download]DownloadFile

   

| | コメント (0)

[Acrobat]起動中のAcrobatは何?(起動中のプロセスを調べる)

tell application "System Events"
set {allAppName} to {name} of (every application process whose (visible is true) and (creator type is not "MACS"))

repeat with everyAppName from 1 to count of allAppName
try
if (item everyAppName of allAppName) is "AdobeReader" then
tell application "Finder"
activate
display dialog "AdobeReaderが起動中です"
end tell
end if
if (item everyAppName of allAppName) is "Acrobat" then
tell application "Finder"
activate
display dialog "Acrobat8?が起動中です"
end tell
end if
if (item everyAppName of allAppName) is "AdobeAcrobat" then
tell application "Finder"
activate
display dialog "Acrobat9が起動中です"
end tell
end if

end try
end repeat
end tell

これは結構使えますね。

 


tell application "System Events"
set {allAppName} to {name} of (every application process whose (visible is true) and (creator type is not "MACS"))
end tell

なら
{{"AdobeAcrobat"}}
と返すし
 

tell application "System Events"
set {allAppName} to {application file} of (every application process whose (visible is true) and (creator type is not "MACS"))
end tell

なら
{{alias "XXXXXXXXXX:Applications:Adobe Acrobat 9 Pro:Adobe Acrobat Pro.app:"}}

 


tell application "System Events"
set {allAppName} to {displayed name} of (every application process whose (visible is true) and (creator type is not "MACS"))
end tell

なら
{{"Acrobat"}}

 

tell application "System Events"
set {allAppName} to {unix id} of (every application process whose (visible is true) and (creator type is not "MACS"))
end tell

なら
起動中のUNIXプロセスID
(これ強制終了とかに使えるなぁ)

 

「systemEventAcro.rtf」をダウンロード[Download]DownloadFile

「systemEventAcro.scpt.zip」をダウンロード[Download]DownloadFile

| | コメント (0)

[Ai]イラストレーター まとめて 書き出し 別名保存

イラストレーターからPDFへの別名保存はこちら[LINK]OpenNewWindow
参考にしてください。


 

Screencapture00220721_95501jst


AppleScriptで一斉に書き出し

オプションが色々ありますから
お好みで色々修正して使ってください。

10.6x
Adobe Illustrator CS4
ドロップレット形式です。





on open DropObj
---------------------ファインダ呼び出し
tell application "Finder"
-----------------ファインダ アクティブ
activate
--------書き出し形式選択
set SetLabels to ¬
"[JPG]", ¬
"[PNG8]", ¬
"[PNG24]", ¬
"[GIF]", ¬
"[PSD]", ¬
"[SWF]", ¬
"[FXG]", ¬
"[EPS]"}
set chooseResult to choose from list SetLabels with prompt "フォーマットを選んでください" OK button name "実行する" with title "フォーマット選択"
-------------------繰り返しの始まり
repeat with ObjFiles in DropObj

-------------------ファイル名を取得
set fileName to name of ObjFiles as string

---------------------パスを取得
set pathAliasDoc to ObjFiles as alias

---------------------パスを文字列に変換
set pathStringDoc to pathAliasDoc as string

---------------------拡張子を判定
set exeName to name extension of ObjFiles

-------------------ファイル名から拡張子を取り除く
set MainFileName to my replace(fileName, "." & exeName, "") as string

--------------------フルパスからファイル名を抜いてディレクトリ名を作る
set pathStringDirName to my replace(pathStringDoc, fileName, "") as string

----------Illustrator呼び出し
tell application "Adobe Illustrator"
-----------Illustrator アクティブ
activate
----------初期設定(アートボード複数利用する方はこちらで設定)
set ArtRange to "" as Unicode text
set backlayers to "background" as Unicode text
------------------◆◆◆ここから選択書き出し
if chooseResult is false then
tell application "Finder"
activate
end tell
---------------------epsで別名で保存
else if chooseResult is {"[EPS]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------epsファイル名
set the EpsFileName to the (the MainFileName & "." & "eps") as string
---------------eps用にディレクトリ名とファイル名をつないでパスにしておく
set saveEpsFileName to (pathStringDirName & ":" & EpsFileName) as string
---------------書き出しオプション
save activDoc in file saveEpsFileName as eps with options ¬
{class:EPS save options ¬
, include document thumbnails:false ¬
, save multiple artboards:false ¬
, overprint:preserve ¬
, PostScript:level 3 ¬
, preview:none ¬
, embed linked files:true ¬
, embed all fonts:true ¬
, compatible gradient printing:true ¬
, compatibility:Illustrator 8 ¬
, CMYK PostScript:true ¬
, artboard range:1 ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------Fxgで別名で保存
else if chooseResult is {"[FXG]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------Fxgファイル名
set the FxgFileName to the (the MainFileName & "." & "fxg") as string
---------------Fxg用にディレクトリ名とファイル名をつないでパスにしておく
set saveFxgFileName to (pathStringDirName & ":" & FxgFileName) as string
---------------書き出しオプション
save activDoc in file saveFxgFileName as fxg with options ¬
{class:FXG save options ¬
, artboard range:ArtRange ¬
, clip content:true ¬
, downsample linked images:false ¬
, filters policy:keep filters editable ¬
, fxg version:version 1.0 ¬
, gradients policy:keep gradients editable ¬
, include metadata:false ¬
, include unused symbols:false ¬
, preserve editing capabilities:true ¬
, save multiple artboards:false ¬
, text policy:keep text editable ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------Flashで別名で保存
else if chooseResult is {"[SWF]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------Flashファイル名
set the SwfFileName to the (the MainFileName & "." & "swf") as string
---------------Flash用にディレクトリ名とファイル名をつないでパスにしておく
set saveSwfFileName to (pathStringDirName & ":" & SwfFileName) as string
---------------書き出しオプション
export activDoc to file saveSwfFileName as Flash with options ¬
{class:Flash export options ¬
, art clipping:output artboard bounds ¬
, artboard range:ArtRange ¬
, background color:{red:255, green:255, blue:255} ¬
, blend animation:none ¬
, compressed:true ¬
, convert text to outlines:true ¬
, curve quality:10 ¬
, export all symbols:false ¬
, export style:Flash file ¬
, export version:SWF version 9 ¬
, Flash Playback Security:flash playback local access ¬
, frame rate:64.0 ¬
, image format:lossless ¬
, JPEG method:optimized ¬
, JPEG quality:8 ¬
, layer order:bottom up ¬
, looping:true ¬
, preserve appearance:false ¬
, read only:false ¬
, replacing:yes ¬
, resolution:144.0 ¬
, save multiple artboards:false ¬
, textkerning:false ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------GIFで別名で保存
else if chooseResult is {"[GIF]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------GIFファイル名
set the GifFileName to the (the MainFileName & "." & "gif") as string
---------------GIF用にディレクトリ名とファイル名をつないでパスにしておく
set saveGifFileName to (pathStringDirName & ":" & GifFileName) as string
---------------書き出しオプション
export activDoc to file saveGifFileName as GIF with options ¬
{class:GIF export options ¬
, antialiasing:true ¬
, artboard clipping:true ¬
, color count:255 ¬
, color dither:none ¬
, color reduction:adaptive ¬
, dither percent:80 ¬
, horizontal scaling:72.0 ¬
, information loss:0 ¬
, interlaced:true ¬
, matte:false ¬
, matte color:{red:255, green:255, blue:255} ¬
, saving as HTML:false ¬
, transparency:true ¬
, vertical scaling:72.0 ¬
, web snap:0 ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------JPGで別名で保存
else if chooseResult is {"[JPG]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------JPGファイル名
set the JPGFileName to the (the MainFileName & "." & "jpg") as string
---------------JPG用にディレクトリ名とファイル名をつないでパスにしておく
set saveJPGFileName to (pathStringDirName & ":" & JPGFileName) as string
---------------書き出しオプション
export activDoc to file saveJPGFileName as JPEG with options ¬
{class:JPEG export options ¬
, antialiasing:true ¬
, artboard clipping:true ¬
, blur:0.0 ¬
, horizontal scaling:72.0 ¬
, matte:false ¬
, matte color:{red:255, green:255, blue:255} ¬
, optimization:true ¬
, quality:80 ¬
, saving as HTML:false ¬
, vertical scaling:72.0 ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------PNG8で別名で保存
else if chooseResult is {"[PNG8]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------pngファイル名
set the PngFileName to the (the MainFileName & "." & "png") as string
---------------png用にディレクトリ名とファイル名をつないでパスにしておく
set savePngFileName to (pathStringDirName & ":" & PngFileName) as string
---------------書き出しオプション
export activDoc to file savePngFileName as PNG8 with options ¬
{class:PNG8 export options ¬
, antialiasing:true ¬
, artboard clipping:true ¬
, color count:255 ¬
, color dither:none ¬
, color reduction:adaptive ¬
, dither percent:80 ¬
, horizontal scaling:72.0 ¬
, interlaced:true ¬
, matte:false ¬
, matte color:{red:255, green:255, blue:255} ¬
, saving as HTML:false ¬
, transparency:true ¬
, vertical scaling:72.0 ¬
, web snap:0 ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------PNG24で別名で保存
else if chooseResult is {"[PNG24]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------pngファイル名
set the PngFileName to the (the MainFileName & "." & "png") as string
---------------png用にディレクトリ名とファイル名をつないでパスにしておく
set savePngFileName to (pathStringDirName & ":" & PngFileName) as string
---------------書き出しオプション
export activDoc to file savePngFileName as PNG24 with options ¬
{class:PNG24 export options ¬
, antialiasing:true ¬
, artboard clipping:true ¬
, matte:false ¬
, matte color:{red:255, green:255, blue:255} ¬
, saving as HTML:false ¬
, transparency:true ¬
, horizontal scaling:72.0 ¬
, vertical scaling:72.0 ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
---------------------Photoshopで別名で保存
else if chooseResult is {"[PSD]"} then
--------------------ファイルを開く
open pathAliasDoc without dialogs
------------------開いたファイルをactivDocとして定義
set activDoc to document 1
----------------Psdファイル名
set the PsdFileName to the (the MainFileName & "." & "psd") as string
---------------Psd用にディレクトリ名とファイル名をつないでパスにしておく
set savePsdFileName to (pathStringDirName & ":" & PsdFileName) as string
---------------書き出しオプション
export activDoc to file savePsdFileName as Photoshop with options ¬
{class:Photoshop export options ¬
, antialiasing:true ¬
, artboard range:ArtRange ¬
, color space:RGB ¬
, editable text:true ¬
, embed ICC profile:true ¬
, maximum editability:true ¬
, resolution:144.0 ¬
, save multiple artboards:true ¬
, warnings:false ¬
, write layers:true ¬
}
------------------アクティブドキュメントを保存しないで閉じる
close activDoc saving no
end if

------------------イラストレーターを解放
end tell
end repeat
end tell
end open

-------------------------文字の置き換えのサブルーチン
to replace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end replace


 


「ai2export.rtf」をダウンロード[Download]DownloadFile

「ai2export.app.zip」をダウンロード[Download]DownloadFile

    

| | コメント (0)

[Acrobat]全ファイル全ページ印刷

AcrobatのAppleScriptは
定義出来る項目が少ないので
あまり良い内容のスクリプトにはならないなぁ

バッチ処理がその代用になるわけなので

黙ってバッチ処理を使った方が良さそうだ


 
ドロップレット形式

制限事項
◆デフォルトのプリンターと用紙に依存します。


10.6
Acrobat9

 



-------------ドロップの始まり
on open DropObj
-------------繰り返しの始まり
repeat with ObjFiles in DropObj
-------------ドロップされたオブジェクト
set afile to ObjFiles
tell application "Finder"
-------------ファイル名を取得
set theName to name of ObjFiles
-------------パスを取得
set theAlias to ObjFiles as alias
-------------パスを文字列に変換
set theAliasPath to theAlias as string
-------------アクロバットを呼び出し
tell application "Adobe Acrobat Pro"
-------------アクティブ
activate
-------------ファイルを開く
open theAliasPath
-------------処理を試す
try
-------------前面のドキュメントをactiveDocと命名
set activeDoc to active doc
-------------activeDocのページ数を調べlastpageに格納
set lastpage to (count active doc each page)
-------------全部印刷
print pages of ¬
activeDoc first 1 last lastpage ¬
PS Level 3 ¬
shrink to fit true ¬
without binary output
-------------保存しないで閉じる
close activeDoc saving no
-------------エラー
on error errorMes
beep
display dialog errorMes
end try
end tell
end tell
end repeat
end open


 

「pdf_Print.app.rtf」をダウンロード[Download]DownloadFile

「pdf_Print.app.zip」をダウンロード[Download]DownloadFile


   
 

ポイントは
ページ数を調べる

tell application "Adobe Acrobat Pro"

set target to active doc


set lastpage to (count active doc each page)

end tell

です。

この方法は結構色々使えます。


| | コメント (0)

[Ai]AppleScriptでPDF書き出し(プリセット選択式)【その2】

【過去記事訂正】AppleScriptでPDF書き出し(プリセット選択式)【その2】の2021年版
訂正しました
https://force4u.cocolog-nifty.com/skywalker/2021/03/post-273799.html


[Ai]AppleScriptでPDF書き出し
(プリセット選択式)[LINK]OpenNewWindowのPDFプリセットを自動で取得する版


 


 


 


吉田印刷のプリセット・ジョブオプションは
こちらから入手できます。
[LINK]OpenNewWindow


 


 


 


10.6x
Adobe Illustrator CS4


 


ドロップレット形式です。


 


 


 


PDFプリセットを
リスト形式で取得して
ダイアログに表示する形式に変更した。


 


 


Screencapture00220715_101931


 


 


 


 







on open DropObj

--------------------------------------------------ファインダ呼び出し

tell application "Finder"

--------------------------------------------------ファインダ アクティブ

activate

----ここからユーザー設定



tell application "Adobe Illustrator"

--------PDFのプリセット名をリスト形式で格納

set PdfPreSetLabels to PDF presets as list

end tell





set chooseResult to choose from list PdfPreSetLabels with prompt "PDFプリセットを選んでください" OK button name "実行する" with title "プリセット選択"

copy the result as list to {the PdfPreSetLabels}



----------PDFプリセットの内容をここで定義します。(このやり方は好みの問題)

if chooseResult is false then

set PDFpre to "Yoshida_PDF_X-1a_aics4" as Unicode text

else

set PDFpre to PdfPreSetLabels as Unicode text

end if



--------------------------------------------------繰り返しの始まり

repeat with ObjFiles in DropObj



--------------------------------------------------ファイル名を取得

set fileName to name of ObjFiles as string



------------------------------------------------パスを取得

set pathAliasDoc to ObjFiles as alias



------------------------------------------------パスを文字列に変換

set pathStringDoc to pathAliasDoc as string



------------------------------------------------拡張子を判定

set exeName to name extension of ObjFiles



--------------------------------------------------ファイル名から拡張子を取り除く

set MainFileName to my replace(fileName, "." & exeName, "") as string



------------------------フルパスからファイル名を抜いてディレクトリ名を作る

set pathStringDirName to my replace(pathStringDoc, fileName, "") as string



----------------PDFファイル名を定義(PDF書き出しするので拡張子をpdfに変更)

set the PDFFileName to the (the MainFileName & "." & "pdf") as string



---------------PDF用にディレクトリ名とファイル名をつないでパスにしておく

set savePDFFileName to (pathStringDirName & ":" & PDFFileName) as string







--------------------------------------------------Illustrator呼び出し

tell application "Adobe Illustrator"



--------------------------------------------------Illustrator アクティブ

activate



--------------------------------------------------ファイルを開く

open pathAliasDoc without dialogs



------------------開いたファイルをactivDocとして定義

set activDoc to document 1





---------------------PDFで別名で保存

save activDoc in file savePDFFileName as pdf with options ¬

{class:PDF save options ¬

, PDF preset:PDFpre ¬

}

----------------------アクティブドキュメントを保存しないで閉じる

close activDoc saving no

----------------------イラストレーターを解放

end tell

end repeat

end tell

end open



-----------------------------文字の置き換えのサブルーチン

to replace(theText, orgStr, newStr)

set oldDelim to AppleScript's text item delimiters

set AppleScript's text item delimiters to orgStr

set tmpList to every text item of theText

set AppleScript's text item delimiters to newStr

set tmpStr to tmpList as text

set AppleScript's text item delimiters to oldDelim

return tmpStr

end replace


 


 


 


 


「ai2PDFpre2.app.zip」をダウンロード[Download]DownloadFile


 


 


「ai2PDFpre2.app.rtf」をダウンロード[LINK]OpenNewWindow


 


 


 


 


 


 


今日気がついたんですが
AppleScriptって64bitモードで動くんですね。


 


 


Screencapture00220715_102653


 


 


 

| | コメント (0)

その他のカテゴリー

Accessibility AccessibilityCheck AccessibilityForm AccessibilityInDesign AccessibilityPDF Acrobat Acrobat Action Acrobat Annotation Acrobat AppleScripts Acrobat Character Acrobat Layer Acrobat PDF Embed API Acrobat PDF Form Print Acrobat Plug-ins Acrobat Portfolios Acrobat Print AcrobatBarcode AcrobatDialog AcrobatForm AcrobatJS AcrobatMenu AcrobatPDF AcrobatStamp AcrobatYouTube AddressBook Adobe Adobe InDesign Adobe Photoshop AdobeAppleScript AdobeBridge AdobeIllustrator AdobeJSX aed Alfresco Android AnimationGif Apple Apple Support AppleScript AppleScriptBasics AppleScriptCharacter AppleScriptColor AppleScriptDroplet AppleScriptErrorNum AppleScriptFolder AppleScriptFontBook AppleScriptRename AppleScriptTools AppleSymbols Applications Barcode Barcode2D BarcodePostal BetterHTMLExport Book BOX Browser buzz Certificates CharacterEntity CharacterSets Colors Cool Site CSS Cutting DecoMail DecorationMail Design Desktop Diff DJ dmg DNS Documents Download DTP eBook Editer eMail Envelopes ExifTool Facebook FFmpeg File System Fonts FontsTool FontsWeb FOOD FormPrint ftp Gadget Gif Animation Google Google Chrome Enterprise HexEditor HTML info iPhoto ISBN ISO iTunes iWork iWorkNumbers iWorkNumbersCalendar iWorkNumbersTimecard iWorkPages JavaScript JeditX JeditX Regexp JeditXAppleScript JIS jquery Letterpress Library logo Mac Admin Mac Archiver Mac Browser Mac Browser Plugin Mac QuickLook Mac Setup Mac Spotlight Mac Video Map Memo Microsoft Teams Mobby mobileconfig Moto Movies Music Network Basic ntp OCR Office OfficePowerPoint OSX Paint Pantone Paper PDFlib Permission Photo Pictograms Print Public Python QuickLook QuickTime QuickTimeSetting QuickTimeSound Real Media ReName ResourceFork ruby Sample Screen ScreenCast Search Security SEO Sharing SLAResource Sound Spotlight Stamp SWF TCC.db Tutorial PSD TV Twitter Typography Unicode Utilities Video WEB APP WebFont Wedding Windows WindowsMedia XML XMP XPS YouTube YouTube Rss