Photoshop

[Photoshop]基本:application

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

######ログ表示
doLogView()

property objMe : a reference to current application


property objNSNotFound : a reference to 9.22337203685477E+18 + 5807


tell application "Adobe Photoshop 2022"
#########################読み取りのみ
##log properties as record
log frontmost as boolean
log name as text
log version as text
log build as text
log scripting version as text
log scripting build date as text
log free memory as number

log default type as list
log windows file types as list
log macintosh file types as list
log system information as text
##log recent files as list
log locale as text
#########################設定可能
log display dialogs as text
-->(always/‌error dialogs/‌never)
##set always to display dialogs

log current tool as text

set listToolName to {"ArtHistoryBrushTool", "3DFOVTool", "3DObjectPanTool", "3DObjectRollTool", "3DObjectRotateTool", "3DObjectScaleTool", "3DObjectSlideTool", "3DOrbitCameraTool", "3DPanCameraTool", "3DRollCameraTool", "3DWalkCameraTool", "addKnotTool", "artBrushTool", "backgroundEraserTool", "blurTool", "bucketTool", "burnInTool", "cloneStampTool", "colorReplacementBrushTool", "colorSamplerTool", "convertKnotTool", "countTool", "cookieCutterTool", "cropTool", "customShapeTool", "deleteKnotTool", "directSelectTool", "dodgeTool", "ellipseTool", "eraserTool", "eyedropperTool", "freeformPenTool", "gradientTool", "handTool", "historyBrushTool", "lassoTool", "lineTool", "magicEraserTool", "magicStampTool", "magicWandTool", "magneticLassoTool", "marqueeEllipTool", "marqueeRectTool", "marqueeSingleColumnTool", "marqueeSingleRowTool", "moveTool", "paintbrushTool", "patchSelection", "pathComponentSelectTool", "patternStampTool", "penTool", "pencilTool", "polySelTool", "polygonTool", "quickSelectTool", "rectangleTool", "redEyeTool", "rotateTool", "roundedRectangleTool", "rulerTool", "saturationTool", "sharpenTool", "sliceSelectTool", "sliceTool", "smudgeTool", "spotHealingBrushTool", "textAnnotTool", "typeCreateMaskTool", "typeCreateOrEditTool", "typeVerticalCreateMaskTool", "typeVerticalCreateOrEditTool", "wetBrushTool", "zoomTool"}

try
set objResponse to (choose from list listToolName with title "短め" with prompt "長め" default items (item 1 of listToolName) OK button name "OK" cancel button name "キャンセル" with multiple selections allowed without empty selection allowed)
on error
log "エラーしました"
return
end try
if objResponse is false then
return
end if

set theResponse to (objResponse) as text

set current tool to theResponse

log current document as list

####塗りのデフォルトカラー
log foreground color as record
set recordForeColor to {class:RGB color, red:255, green:255, blue:255}
set foreground color to recordForeColor
set recordForeColor to {class:CMYK color, cyan:0.0, magenta:0.0, yellow:0.0, black:0.0}
set foreground color to recordForeColor

###背景色のデフォルトカラー
log background color as record
set recordBackgroundColor to {class:RGB color, red:255, green:255, blue:255}
set background color to recordBackgroundColor
set recordBackgroundColor to {class:CMYK color, cyan:0.0, magenta:0.0, yellow:0.0, black:0.0}
set background color to recordBackgroundColor

log color settings as list

####通知設定
set boolNotifiers to notifiers enabled as boolean
if boolNotifiers is false then
set notifiers enabled to true as boolean
else
set notifiers enabled to false as boolean
end if


log preferences folder as alias
###設定フォルダを開く
set aliasPrefDir to preferences folder as alias
tell application "Finder"
make new Finder window to aliasPrefDir
select folder aliasPrefDir
end tell

end tell











display notification "処理終了" with title "処理が終了" subtitle "処理が終了しました" sound name "Sonumi"
log ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"
return ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"




#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[Photoshop]レイヤの名前をつける(自分用)

レイヤの名前やIDを指定して、他の処理に渡す時用


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat


tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer
####レイヤ判定時にはIDを使うといいよ
####選択中のレイヤのID
####set numActivLayerID to id of objActivLayer
####
set listEveryLayerSet to every layer set as list
log listEveryLayerSet
##
set numCntEveryLayerSet to (count of listEveryLayerSet) as number
########ROOT
if numCntEveryLayerSet > 0 then
repeat with objLayerSet in listEveryLayerSet
tell objLayerSet
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
########1階層目
set listEveryLayerSet1 to every layer set as list
set numCntEveryLayerSet1 to (count of listEveryLayerSet1) as number
if numCntEveryLayerSet1 > 0 then
repeat with objLayerSet1 in listEveryLayerSet1
tell objLayerSet1
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer1 to every art layer as list
repeat with objArtLayer1 in listEveryArtLayer1
tell objArtLayer1
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
########2階層目
set listEveryLayerSet2 to every layer set as list
log listEveryLayerSet2
set numCntEveryLayerSet2 to (count of listEveryLayerSet2) as number
if numCntEveryLayerSet2 > 0 then
repeat with objLayerSet2 in listEveryLayerSet2
tell objLayerSet2
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer2 to every art layer as list
repeat with objArtLayer2 in listEveryArtLayer2
tell objArtLayer2
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
########3階層目
set listEveryLayerSet3 to every layer set as list
set numCntEveryLayerSet3 to (count of listEveryLayerSet3) as number
if numCntEveryLayerSet3 > 0 then
repeat with objLayerSet3 in listEveryLayerSet3
tell objLayerSet3
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer3 to every art layer as list
repeat with objArtLayer3 in listEveryArtLayer3
tell objArtLayer3
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
########4階層目
set listEveryLayerSet4 to every layer set as list
set numCntEveryLayerSet4 to (count of listEveryLayerSet4) as number
if numCntEveryLayerSet4 > 0 then
repeat with objLayerSet4 in listEveryLayerSet4
tell objLayerSet4
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer4 to every art layer as list
repeat with objArtLayer4 in listEveryArtLayer4
tell objArtLayer4
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
########5階層目
set listEveryLayerSet5 to every layer set as list
set numCntEveryLayerSet5 to (count of listEveryLayerSet5) as number
if numCntEveryLayerSet5 > 0 then
repeat with objLayerSet5 in listEveryLayerSet5
tell objLayerSet5
set numLayerSetID to id
set name to ("LayerSet-" & numLayerSetID & "") as text
set listEveryArtLayer5 to every art layer as list
repeat with objArtLayer5 in listEveryArtLayer5
tell objArtLayer5
set numArtLayerID to id
set name to ("ArtLayer-" & numArtLayerID & "") as text
end tell
end repeat
end tell
end repeat
end if
################5階層目
end tell
end repeat
end if
################4階層目
end tell
end repeat
end if
################3階層目
end tell
end repeat
end if
################2階層目
end tell
end repeat
end if
################1階層目
end tell
end repeat
########レイヤーセットのネストの終了
end if
#######通常のROOTにあるレイヤ
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
if background layer of objArtLayer is false then
tell objArtLayer
set objkindArtLayer to kind of objArtLayer
set numArtLayerID to id of objArtLayer
if objkindArtLayer is text layer then
set name to ("TextLayer-" & numArtLayerID & "") as text
##set name to ("テキスト:" & numArtLayerID & "") as text
else if objkindArtLayer is levels layer then
set name to ("LevelsLayer-" & numArtLayerID & "") as text
##set name to ("レベル補正:" & numArtLayerID & "") as text
else if objkindArtLayer is curves layer then
set name to ("CurvesLayer-" & numArtLayerID & "") as text
##set name to ("トーンカーブ:" & numArtLayerID & "") as text
else if objkindArtLayer is exposure layer then
set name to ("露光Layer-" & numArtLayerID & "") as text
##set name to ("トーンカーブ:" & numArtLayerID & "") as text
else if objkindArtLayer is gradient fill layer then
set name to ("GradientFillLayer-" & numArtLayerID & "") as text
##set name to ("グラデーション:" & numArtLayerID & "") as text
else if objkindArtLayer is solid fill layer then
set name to ("SolidFillLayer-" & numArtLayerID & "") as text
##set name to ("単色塗り:" & numArtLayerID & "") as text
else if objkindArtLayer is pattern fill layer then
set name to ("PatternFillLayer-" & numArtLayerID & "") as text
##set name to ("パータン塗り:" & numArtLayerID & "") as text
else if objkindArtLayer is brightness contrast layer then
set name to ("BrightContrastLayer-" & numArtLayerID & "") as text
##set name to ("明るさコントラスト:" & numArtLayerID & "") as text
else if objkindArtLayer is vibrance layer then
set name to ("VibranceLayer-" & numArtLayerID & "") as text
##set name to ("自然な彩度:" & numArtLayerID & "") as text
else if objkindArtLayer is hue saturation layer then
set name to ("HueLayer-" & numArtLayerID & "") as text
##set name to ("色相彩度:" & numArtLayerID & "") as text
else if objkindArtLayer is color balance layer then
set name to ("ColorBalanceLayer-" & numArtLayerID & "") as text
##set name to ("カラーバランス:" & numArtLayerID & "") as text
else if objkindArtLayer is black and white layer then
set name to ("BWLayer-" & numArtLayerID & "") as text
##set name to ("白黒:" & numArtLayerID & "") as text
else if objkindArtLayer is photo filter layer then
set name to ("PhotoFilterLayer-" & numArtLayerID & "") as text
##set name to ("レンズフィルタ:" & numArtLayerID & "") as text
else if objkindArtLayer is channel mixer layer then
set name to ("ChannelMixerLayer-" & numArtLayerID & "") as text
##set name to ("チャンネルミキサー:" & numArtLayerID & "") as text
else if objkindArtLayer is color lookup then
set name to ("ColorLookupLayer-" & numArtLayerID & "") as text
##set name to ("カラールックアップ:" & numArtLayerID & "") as text
else if objkindArtLayer is inversion layer then
set name to ("InversionLayer-" & numArtLayerID & "") as text
##set name to ("反転:" & numArtLayerID & "") as text
else if objkindArtLayer is posterize layer then
set name to ("PosterizeLayer-" & numArtLayerID & "") as text
##set name to ("ポスタリゼーション:" & numArtLayerID & "") as text
else if objkindArtLayer is threshold layer then
set name to ("ThresholdLayer-" & numArtLayerID & "") as text
##set name to ("2階調:" & numArtLayerID & "") as text
else if objkindArtLayer is gradient map layer then
set name to ("GradientMapLayer-" & numArtLayerID & "") as text
##set name to ("グラデーションマップ:" & numArtLayerID & "") as text
else if objkindArtLayer is selective color layer then
set name to ("SelectiveColorLayer-" & numArtLayerID & "") as text
##set name to ("特色:" & numArtLayerID & "") as text
else if objkindArtLayer is smart object layer then
set name to ("SmartObjectLayer-" & numArtLayerID & "") as text
##set name to ("スマートオブジェクト:" & numArtLayerID & "") as text
else
set name to ("ArtLayer-" & numArtLayerID & "") as text
##set name to ("アートレイヤ:" & numArtLayerID & "") as text
end if

###リンクレイヤーにLをつける
set objLinkLayer to linked layers of objArtLayer
if objLinkLayer is not {} then
set name to ("" & name & "L") as text
end if

end tell




end if

end repeat

end tell
end tell

|

[Photoshop]選択レイヤをロックして、それ以外はロック解除

レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat


tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer

####レイヤ判定時にはIDを使うといいよ
####選択中のレイヤのID
####set numActivLayerID to id of objActivLayer
####
set listEveryLayerSet to every layer set as list
log listEveryLayerSet
##
set numCntEveryLayerSet to (count of listEveryLayerSet) as number
########ROOT
if numCntEveryLayerSet > 0 then
repeat with objLayerSet in listEveryLayerSet
tell objLayerSet
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to false
end tell
end repeat
########1階層目
set listEveryLayerSet1 to every layer set as list
set numCntEveryLayerSet1 to (count of listEveryLayerSet1) as number
if numCntEveryLayerSet1 > 0 then
repeat with objLayerSet1 in listEveryLayerSet1
tell objLayerSet1
set listEveryArtLayer1 to every art layer as list
repeat with objArtLayer1 in listEveryArtLayer1
tell objArtLayer1
set all locked to false
end tell
end repeat
########2階層目
set listEveryLayerSet2 to every layer set as list
log listEveryLayerSet2
set numCntEveryLayerSet2 to (count of listEveryLayerSet2) as number
if numCntEveryLayerSet2 > 0 then
repeat with objLayerSet2 in listEveryLayerSet2
tell objLayerSet2
set listEveryArtLayer2 to every art layer as list
repeat with objArtLayer2 in listEveryArtLayer2
tell objArtLayer2
set all locked to false
end tell
end repeat
########3階層目
set listEveryLayerSet3 to every layer set as list
set numCntEveryLayerSet3 to (count of listEveryLayerSet3) as number
if numCntEveryLayerSet3 > 0 then
repeat with objLayerSet3 in listEveryLayerSet3
tell objLayerSet3
set listEveryArtLayer3 to every art layer as list
repeat with objArtLayer3 in listEveryArtLayer3
tell objArtLayer3
set all locked to false
end tell
end repeat
########4階層目
set listEveryLayerSet4 to every layer set as list
set numCntEveryLayerSet4 to (count of listEveryLayerSet4) as number
if numCntEveryLayerSet4 > 0 then
repeat with objLayerSet4 in listEveryLayerSet4
tell objLayerSet4
set listEveryArtLayer4 to every art layer as list
repeat with objArtLayer4 in listEveryArtLayer4
tell objArtLayer4
set all locked to false
end tell
end repeat
########5階層目
set listEveryLayerSet5 to every layer set as list
set numCntEveryLayerSet5 to (count of listEveryLayerSet5) as number
if numCntEveryLayerSet5 > 0 then
repeat with objLayerSet5 in listEveryLayerSet5
tell objLayerSet5
set listEveryArtLayer5 to every art layer as list
repeat with objArtLayer5 in listEveryArtLayer5
tell objArtLayer5
set all locked to false
end tell
end repeat
set all locked to false
end tell
end repeat
end if
################5階層目
set all locked to false
end tell
end repeat
end if
################4階層目
set all locked to false
end tell
end repeat
end if
################3階層目
set all locked to false
end tell
end repeat
end if
################2階層目
set all locked to false
end tell
end repeat
end if
################1階層目
end tell
end repeat
########レイヤーセットのネストの終了
end if
#######通常のROOTにあるレイヤ
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to false
end tell
end repeat
######ロック終了
####選択中のレイヤのみロック解除
if background layer of objActivLayer is false then
tell objActivLayer
set all locked to true
end tell
end if
end tell
end tell

|

[Photoshop]レイヤロック

レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat


tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer
####レイヤ判定時にはIDを使うといいよ
####選択中のレイヤのID
####set numActivLayerID to id of objActivLayer
####
set listEveryLayerSet to every layer set as list
log listEveryLayerSet
##
set numCntEveryLayerSet to (count of listEveryLayerSet) as number
########ROOT
if numCntEveryLayerSet > 0 then
repeat with objLayerSet in listEveryLayerSet
tell objLayerSet
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to true
end tell
end repeat
########1階層目
set listEveryLayerSet1 to every layer set as list
set numCntEveryLayerSet1 to (count of listEveryLayerSet1) as number
if numCntEveryLayerSet1 > 0 then
repeat with objLayerSet1 in listEveryLayerSet1
tell objLayerSet1
set listEveryArtLayer1 to every art layer as list
repeat with objArtLayer1 in listEveryArtLayer1
tell objArtLayer1
set all locked to true
end tell
end repeat
########2階層目
set listEveryLayerSet2 to every layer set as list
log listEveryLayerSet2
set numCntEveryLayerSet2 to (count of listEveryLayerSet2) as number
if numCntEveryLayerSet2 > 0 then
repeat with objLayerSet2 in listEveryLayerSet2
tell objLayerSet2
set listEveryArtLayer2 to every art layer as list
repeat with objArtLayer2 in listEveryArtLayer2
tell objArtLayer2
set all locked to true
end tell
end repeat
########3階層目
set listEveryLayerSet3 to every layer set as list
set numCntEveryLayerSet3 to (count of listEveryLayerSet3) as number
if numCntEveryLayerSet3 > 0 then
repeat with objLayerSet3 in listEveryLayerSet3
tell objLayerSet3
set listEveryArtLayer3 to every art layer as list
repeat with objArtLayer3 in listEveryArtLayer3
tell objArtLayer3
set all locked to true
end tell
end repeat
########4階層目
set listEveryLayerSet4 to every layer set as list
set numCntEveryLayerSet4 to (count of listEveryLayerSet4) as number
if numCntEveryLayerSet4 > 0 then
repeat with objLayerSet4 in listEveryLayerSet4
tell objLayerSet4
set listEveryArtLayer4 to every art layer as list
repeat with objArtLayer4 in listEveryArtLayer4
tell objArtLayer4
set all locked to true
end tell
end repeat
########5階層目
set listEveryLayerSet5 to every layer set as list
set numCntEveryLayerSet5 to (count of listEveryLayerSet5) as number
if numCntEveryLayerSet5 > 0 then
repeat with objLayerSet5 in listEveryLayerSet5
tell objLayerSet5
set listEveryArtLayer5 to every art layer as list
repeat with objArtLayer5 in listEveryArtLayer5
tell objArtLayer5
set all locked to true
end tell
end repeat
set all locked to true
end tell
end repeat
end if
################5階層目
set all locked to true
end tell
end repeat
end if
################4階層目
set all locked to true
end tell
end repeat
end if
################3階層目
set all locked to true
end tell
end repeat
end if
################2階層目
set all locked to true
end tell
end repeat
end if
################1階層目
end tell
end repeat
########レイヤーセットのネストの終了
end if
#######通常のROOTにあるレイヤ
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
if background layer of objActivLayer is false then
tell objArtLayer
set all locked to true
end tell
end if
end repeat

end tell
end tell

|

[Photoshop]レイヤロック解除

レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat


tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer
####レイヤ判定時にはIDを使うといいよ
####選択中のレイヤのID
####set numActivLayerID to id of objActivLayer
####
set listEveryLayerSet to every layer set as list
log listEveryLayerSet
##
set numCntEveryLayerSet to (count of listEveryLayerSet) as number
########ROOT
if numCntEveryLayerSet > 0 then
repeat with objLayerSet in listEveryLayerSet
tell objLayerSet
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to false
end tell
end repeat
########1階層目
set listEveryLayerSet1 to every layer set as list
set numCntEveryLayerSet1 to (count of listEveryLayerSet1) as number
if numCntEveryLayerSet1 > 0 then
repeat with objLayerSet1 in listEveryLayerSet1
tell objLayerSet1
set listEveryArtLayer1 to every art layer as list
repeat with objArtLayer1 in listEveryArtLayer1
tell objArtLayer1
set all locked to false
end tell
end repeat
########2階層目
set listEveryLayerSet2 to every layer set as list
log listEveryLayerSet2
set numCntEveryLayerSet2 to (count of listEveryLayerSet2) as number
if numCntEveryLayerSet2 > 0 then
repeat with objLayerSet2 in listEveryLayerSet2
tell objLayerSet2
set listEveryArtLayer2 to every art layer as list
repeat with objArtLayer2 in listEveryArtLayer2
tell objArtLayer2
set all locked to false
end tell
end repeat
########3階層目
set listEveryLayerSet3 to every layer set as list
set numCntEveryLayerSet3 to (count of listEveryLayerSet3) as number
if numCntEveryLayerSet3 > 0 then
repeat with objLayerSet3 in listEveryLayerSet3
tell objLayerSet3
set listEveryArtLayer3 to every art layer as list
repeat with objArtLayer3 in listEveryArtLayer3
tell objArtLayer3
set all locked to false
end tell
end repeat
########4階層目
set listEveryLayerSet4 to every layer set as list
set numCntEveryLayerSet4 to (count of listEveryLayerSet4) as number
if numCntEveryLayerSet4 > 0 then
repeat with objLayerSet4 in listEveryLayerSet4
tell objLayerSet4
set listEveryArtLayer4 to every art layer as list
repeat with objArtLayer4 in listEveryArtLayer4
tell objArtLayer4
set all locked to false
end tell
end repeat
########5階層目
set listEveryLayerSet5 to every layer set as list
set numCntEveryLayerSet5 to (count of listEveryLayerSet5) as number
if numCntEveryLayerSet5 > 0 then
repeat with objLayerSet5 in listEveryLayerSet5
tell objLayerSet5
set listEveryArtLayer5 to every art layer as list
repeat with objArtLayer5 in listEveryArtLayer5
tell objArtLayer5
set all locked to false
end tell
end repeat
set all locked to false
end tell
end repeat
end if
################5階層目
set all locked to false
end tell
end repeat
end if
################4階層目
set all locked to false
end tell
end repeat
end if
################3階層目
set all locked to false
end tell
end repeat
end if
################2階層目
set all locked to false
end tell
end repeat
end if
################1階層目
end tell
end repeat
########レイヤーセットのネストの終了
end if
#######通常のROOTにあるレイヤ
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to false
end tell
end repeat

end tell
end tell

|

[Photoshop]選択レイヤ以外をロック

レイヤグループ(Layer Set)の入れ子ネスト構造は5階層まで対応

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat


tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer
####処理しないパターン
set onjClassOfActivLayer to class of objActivLayer
if onjClassOfActivLayer is equal to layer set then
return "選択レイヤがレイヤセットの時は処理しない"
else if background layer of objActivLayer is true then
return "選択レイヤが背景の時は処理しない"
end if
####レイヤ判定時にはIDを使うといいよ
####選択中のレイヤのID
####set numActivLayerID to id of objActivLayer
####
set listEveryLayerSet to every layer set as list
log listEveryLayerSet
##
set numCntEveryLayerSet to (count of listEveryLayerSet) as number
########ROOT
if numCntEveryLayerSet > 0 then
repeat with objLayerSet in listEveryLayerSet
tell objLayerSet
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to true
end tell
end repeat
########1階層目
set listEveryLayerSet1 to every layer set as list
set numCntEveryLayerSet1 to (count of listEveryLayerSet1) as number
if numCntEveryLayerSet1 > 0 then
repeat with objLayerSet1 in listEveryLayerSet1
tell objLayerSet1
set listEveryArtLayer1 to every art layer as list
repeat with objArtLayer1 in listEveryArtLayer1
tell objArtLayer1
set all locked to true
end tell
end repeat
########2階層目
set listEveryLayerSet2 to every layer set as list
log listEveryLayerSet2
set numCntEveryLayerSet2 to (count of listEveryLayerSet2) as number
if numCntEveryLayerSet2 > 0 then
repeat with objLayerSet2 in listEveryLayerSet2
tell objLayerSet2
set listEveryArtLayer2 to every art layer as list
repeat with objArtLayer2 in listEveryArtLayer2
tell objArtLayer2
set all locked to true
end tell
end repeat
########3階層目
set listEveryLayerSet3 to every layer set as list
set numCntEveryLayerSet3 to (count of listEveryLayerSet3) as number
if numCntEveryLayerSet3 > 0 then
repeat with objLayerSet3 in listEveryLayerSet3
tell objLayerSet3
set listEveryArtLayer3 to every art layer as list
repeat with objArtLayer3 in listEveryArtLayer3
tell objArtLayer3
set all locked to true
end tell
end repeat
########4階層目
set listEveryLayerSet4 to every layer set as list
set numCntEveryLayerSet4 to (count of listEveryLayerSet4) as number
if numCntEveryLayerSet4 > 0 then
repeat with objLayerSet4 in listEveryLayerSet4
tell objLayerSet4
set listEveryArtLayer4 to every art layer as list
repeat with objArtLayer4 in listEveryArtLayer4
tell objArtLayer4
set all locked to true
end tell
end repeat
########5階層目
set listEveryLayerSet5 to every layer set as list
set numCntEveryLayerSet5 to (count of listEveryLayerSet5) as number
if numCntEveryLayerSet5 > 0 then
repeat with objLayerSet5 in listEveryLayerSet5
tell objLayerSet5
set listEveryArtLayer5 to every art layer as list
repeat with objArtLayer5 in listEveryArtLayer5
tell objArtLayer5
set all locked to true
end tell
end repeat
##set all locked to true
end tell
end repeat
end if
################5階層目
##set all locked to true
end tell
end repeat
end if
################4階層目
##set all locked to true
end tell
end repeat
end if
################3階層目
##set all locked to true
end tell
end repeat
end if
################2階層目
##set all locked to true
end tell
end repeat
end if
################1階層目
end tell
end repeat
########レイヤーセットのネストの終了
end if
#######通常のROOTにあるレイヤ
set listEveryArtLayer to every art layer as list
repeat with objArtLayer in listEveryArtLayer
tell objArtLayer
set all locked to true
end tell
end repeat
######ロック終了
####選択中のレイヤのみロック解除
tell objActivLayer
set all locked to false
end tell
end tell
end tell

|

[Photoshop]選択レイヤを『背景』レイヤに

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

tell application "Adobe Photoshop 2022"
###全面ドキュメントを定義
set objActivDoc to current document
###全面ドキュメント
tell objActivDoc
####アクティブレイヤ
set objActivLayer to current layer
tell objActivLayer
####背景にする
set background layer to true
end tell
end tell
end tell

|

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat AddOn Acrobat Annotation Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Menu Acrobat Open Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat python Acrobat Reader Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin Support Admin System Information Admin Tools Admin Users Admin Volumes Adobe Adobe FDKO Adobe RemoteUpdateManager AppKit Apple AppleScript AppleScript do shell script AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript System Events AppleScript System Events Plist AppleScript Video Applications AppStore Archive Attributes Automator BackUp Barcode Barcode QR Barcode QR Decode Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome CIImage CityCode CloudStorage Color com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode UTF8 Error EXIFData ffmpeg File Finder Firefox Folder FolderAction Fonts GIF github Guide HTML HTML Entity Icon Illustrator Image Events Image2PDF ImageOptim iPhone iWork Javascript Jedit Json Label Leading Zero List locationd LRC lsappinfo LSSharedFileList m3u8 Mail MakePDF Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Mouse Music NetWork Notes NSArray NSArray Sort NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSColor NSColorList NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSPrintOperation NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth OneDrive PDF PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline perl Photoshop PlistBuddy pluginkit postalcode PostScript prefPane Preview Python QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver SF Symbols character id SF Symbols Entity sips Skype Slack Sound Spotlight sqlite SRT StandardAdditions Swift System Settings TCC TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code Wacom webarchive webp Wifi Windows XML XML EPUB XML OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML XMP YouTube zoom