AppleScriptを投稿
セーブダイアログのファイル名入力欄を選択するAppleScript
tell application "System Events"
set a to name of first application process whose frontmost is true
tell window 1 of process a
try
set focused of text field 1 to true
on error
set focused of text field 1 of sheet 1 to true
end try
end tell
end tell
VariableはKeyboard Maestroで入力。
PhotoshopオプションバーのWindow IDがパネルの出方でころころ変わるので総当たりし、pop up buttonのvalueを調べてアタリならクリックする、感じ。パネル数等で処理速度が大きく変わる
入れ子のrepeatの抜け方これでいいのかな。
(2019/03/22 returnでええやんてことに気づいた(遅い) KMで拾うために1を返してる(trueだと読んでくれなかった)
修正w 元のツールに戻れてなかった
tell application “Adobe Photoshop CC 2019” to set myOriToolName to do javascript “app.currentTool”
tell application “Keyboard Maestro Engine” to set myVar to getvariable “Variable”
set myText to {" ピクセル四方の平均", “指定したピクセル”}
tell application “System Events”
tell process “Photoshop CC”
my selectTools(“eyedropperTool”)
repeat with i from 1 to 20
repeat with b in {1, 3, 5,6}
try
set myItem to pop up button b of window i
set myValue to value of myItem
if myValue contains item 1 of myText or myValue contains item 2 of myText then
click myItem
click menu item (myVar as number) of menu 1 of myItem
my selectTools(myOriToolName)
return 1
end if
end try
end repeat
end repeat
end tell
end tell
on selectTools(myToolName)
tell application “Adobe Photoshop CC 2019” to do javascript “var desc9 = new ActionDescriptor();var ref7 = new ActionReference();ref7.putClass( app.stringIDToTypeID(” & quoted form of myToolName & “) );desc9.putReference( app.charIDToTypeID(‘null’), ref7 );executeAction( app.charIDToTypeID(‘slct’), desc9, DialogModes.NO );”
end selectTools
■ここから旧いの。returnで抜けたらその後の処理しないだろー
tell application “Adobe Photoshop CC 2019” to set myOriToolName to do javascript “app.currentTool”
tell application “Keyboard Maestro Engine” to set myVar to getvariable “Variable”
selectTools(“eyedropperTool”)
tell application “System Events”
tell process “Photoshop CC”
repeat with i from 1 to 20
repeat with a in {2.4}
try
set myItem to pop up button a of window i
if value of myItem contains “のレイヤー” then
click myItem
click menu item (myVar as number) of menu 1 of myItem
return 1
end if
end try
end repeat
end repeat
end tell
end tell
selectTools(myOriToolName)
return myFlag
on selectTools(myToolName)
tell application “Adobe Photoshop CC 2019” to do javascript “var desc9 = new ActionDescriptor();var ref7 = new ActionReference();ref7.putClass( app.stringIDToTypeID(” & quoted form of myToolName & “) );desc9.putReference( app.charIDToTypeID(‘null’), ref7 );executeAction( app.charIDToTypeID(‘slct’), desc9, DialogModes.NO );”
end selectTools