|
<?xml version="1.0" encoding="UTF-8"?> |
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
|
<plist version="1.0"> |
|
<array> |
|
<dict> |
|
<key>Activate</key> |
|
<string>OnceWithPalette</string> |
|
<key>AddToMacroPalette</key> |
|
<true/> |
|
<key>AddToStatusMenu</key> |
|
<true/> |
|
<key>CreationDate</key> |
|
<real>487499811.51941299</real> |
|
<key>KeyCode</key> |
|
<integer>3</integer> |
|
<key>Macros</key> |
|
<array> |
|
<dict> |
|
<key>Actions</key> |
|
<array> |
|
<dict> |
|
<key>ActionUID</key> |
|
<integer>69978</integer> |
|
<key>DisplayKind</key> |
|
<string>Variable</string> |
|
<key>HonourFailureSettings</key> |
|
<true/> |
|
<key>IncludeStdErr</key> |
|
<false/> |
|
<key>IncludedVariables</key> |
|
<array> |
|
<string>9999</string> |
|
</array> |
|
<key>MacroActionType</key> |
|
<string>ExecuteAppleScript</string> |
|
<key>NotifyOnFailure</key> |
|
<false/> |
|
<key>Path</key> |
|
<string></string> |
|
<key>Text</key> |
|
<string>tell application id "com.adobe.photoshop" to name of current layer of current document</string> |
|
<key>TimeOutAbortsMacro</key> |
|
<true/> |
|
<key>TrimResults</key> |
|
<true/> |
|
<key>TrimResultsNew</key> |
|
<true/> |
|
<key>UseText</key> |
|
<true/> |
|
<key>Variable</key> |
|
<string>PSLayerName</string> |
|
</dict> |
|
<dict> |
|
<key>ActionUID</key> |
|
<integer>69979</integer> |
|
<key>Floating</key> |
|
<true/> |
|
<key>HasTitle</key> |
|
<false/> |
|
<key>MacroActionType</key> |
|
<string>CustomPrompt</string> |
|
<key>Text</key> |
|
<string><!DOCTYPE html> |
|
<html lang="ja-jp"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<title>レイヤー名編集</title> |
|
<style> |
|
#textinput{ |
|
border:none; |
|
border-radius:20px; |
|
padding:5px 15px; |
|
font-family:"ヒラギノ角ゴ Pro W3"; |
|
font-size:48px; |
|
background-color:#f2f2f2; |
|
width:95%; |
|
} |
|
</style> |
|
<script type="text/javascript"> |
|
document.addEventListener('keydown', function(e) { |
|
if(e.key === 'Escape'){ |
|
window.KeyboardMaestro.Cancel(''); |
|
} |
|
}) |
|
const a = window.KeyboardMaestro.GetVariable('PSLayerName'); |
|
function init1() { |
|
document.getElementById("textinput").value=a; |
|
document.getElementById("textinput").focus(); |
|
document.getElementById("textinput").select(); |
|
} |
|
</script> |
|
</head> |
|
<body data-kmwindow="1300,140" onload="init1()"> |
|
<form> |
|
<input type="text" id="textinput" name="PSLayerName"> |
|
<button type="submit" style="padding:0;border:0;" onclick="window.KeyboardMaestro.Submit()"></button> |
|
</form> |
|
</body> |
|
</html></string> |
|
<key>TimeOutAbortsMacro</key> |
|
<true/> |
|
<key>Transparent</key> |
|
<true/> |
|
<key>UseText</key> |
|
<true/> |
|
</dict> |
|
<dict> |
|
<key>ActionUID</key> |
|
<integer>70774</integer> |
|
<key>Conditions</key> |
|
<dict> |
|
<key>ConditionList</key> |
|
<array> |
|
<dict> |
|
<key>ConditionType</key> |
|
<string>Text</string> |
|
<key>Text</key> |
|
<string>%HTMLResult%</string> |
|
<key>TextConditionType</key> |
|
<string>IsNot</string> |
|
<key>TextValue</key> |
|
<string>Cancel</string> |
|
</dict> |
|
</array> |
|
<key>ConditionListMatch</key> |
|
<string>All</string> |
|
</dict> |
|
<key>ElseActionListDisclosed</key> |
|
<false/> |
|
<key>ElseActions</key> |
|
<array/> |
|
<key>MacroActionType</key> |
|
<string>IfThenElse</string> |
|
<key>ThenActions</key> |
|
<array> |
|
<dict> |
|
<key>ActionUID</key> |
|
<integer>70775</integer> |
|
<key>DisplayKind</key> |
|
<string>None</string> |
|
<key>HonourFailureSettings</key> |
|
<true/> |
|
<key>IncludeStdErr</key> |
|
<false/> |
|
<key>IncludedVariables</key> |
|
<array> |
|
<string>9999</string> |
|
</array> |
|
<key>IsActive</key> |
|
<false/> |
|
<key>IsDisclosed</key> |
|
<false/> |
|
<key>MacroActionType</key> |
|
<string>ExecuteAppleScript</string> |
|
<key>Path</key> |
|
<string></string> |
|
<key>Text</key> |
|
<string>-- 1. KMからレイヤー名を取得 |
|
tell application "Keyboard Maestro Engine" |
|
set myLN to getvariable "PSLayerName" as text |
|
end tell |
|
|
|
-- 2. PSLayerNameの先頭が「★」なら JSXで一括置換 |
|
if myLN starts with "★" then |
|
set jsxCode to " |
|
app.activeDocument.suspendHistory('Rename ★ to ☆', 'main()'); |
|
|
|
function main() { |
|
if (app.documents.length === 0) return; |
|
|
|
var skipName = app.activeDocument.activeLayer.name; |
|
renameLayers(app.activeDocument.layers, skipName); |
|
} |
|
|
|
function renameLayers(layerCollection, skipName) { |
|
for (var i = 0; i < layerCollection.length; i++) { |
|
var layer = layerCollection[i]; |
|
|
|
// アクティブレイヤーは除外 |
|
if (layer.name === skipName) continue; |
|
|
|
// レイヤー名が★で始まるなら☆に置換 |
|
if (layer.name.charAt(0) === '★') { |
|
layer.name = (layer.name.length === 1) ? '☆' : '☆' + layer.name.substring(1); |
|
} |
|
|
|
// レイヤーグループなら再帰 |
|
if (layer.typename === 'LayerSet') { |
|
renameLayers(layer.layers, skipName); |
|
} |
|
} |
|
} |
|
" |
|
tell application id "com.adobe.photoshop" |
|
do javascript jsxCode |
|
end tell |
|
end if |
|
|
|
-- 3. アクティブレイヤーの名前を Keyboard Maestro の変数で上書き |
|
tell application id "com.adobe.photoshop" |
|
set name of current layer of current document to myLN |
|
end tell |
|
</string> |
|
<key>TimeOutAbortsMacro</key> |
|
<true/> |
|
<key>TrimResults</key> |
|
<true/> |
|
<key>TrimResultsNew</key> |
|
<true/> |
|
<key>UseText</key> |
|
<true/> |
|
</dict> |
|
<dict> |
|
<key>ActionUID</key> |
|
<integer>14348099</integer> |
|
<key>DisplayKind</key> |
|
<string>None</string> |
|
<key>HonourFailureSettings</key> |
|
<true/> |
|
<key>IncludeStdErr</key> |
|
<false/> |
|
<key>IncludedVariables</key> |
|
<array> |
|
<string>9999</string> |
|
</array> |
|
<key>MacroActionType</key> |
|
<string>ExecuteAppleScript</string> |
|
<key>Path</key> |
|
<string></string> |
|
<key>Text</key> |
|
<string>-- 1. JSXコード(先に定義しておく) |
|
set jsxCode to " |
|
app.activeDocument.suspendHistory('Rename ★ to ☆', 'main()'); |
|
|
|
function main() { |
|
if (app.documents.length === 0) return; |
|
|
|
var skipLayer = app.activeDocument.activeLayer; |
|
renameLayers(app.activeDocument.layers, skipLayer); |
|
} |
|
|
|
function renameLayers(layerCollection, skipLayer) { |
|
for (var i = 0; i < layerCollection.length; i++) { |
|
var layer = layerCollection[i]; |
|
|
|
// 再帰はグループなら常に行う(グループ内の処理は止めない) |
|
if (layer.typename === 'LayerSet') { |
|
renameLayers(layer.layers, skipLayer); |
|
} |
|
|
|
// アクティブレイヤー自身(Layer or LayerSet)だけは除外して名前変更しない |
|
if (layer === skipLayer) continue; |
|
|
|
// ★で始まる名前なら置換 |
|
if (layer.name.charAt(0) === '★') { |
|
layer.name = (layer.name.length === 1) ? '☆' : '☆' + layer.name.substring(1); |
|
} |
|
} |
|
} |
|
" |
|
|
|
-- 1. JSXコード(省略、内容同じ) |
|
|
|
-- 変数取得 |
|
tell application "Keyboard Maestro Engine" |
|
set myLN to getvariable "PSLayerName" as text |
|
end tell |
|
|
|
-- 星チェック処理 |
|
set processFlag to false |
|
|
|
if myLN starts with "★" then |
|
if (length of myLN) > 1 then |
|
set restText to text 2 thru -1 of myLN |
|
set secondOffset to offset of "★" in restText |
|
if secondOffset is 0 then |
|
set processFlag to true |
|
end if |
|
else |
|
-- 1文字のみが「★」の場合も処理対象 |
|
set processFlag to true |
|
end if |
|
end if |
|
|
|
if processFlag then |
|
tell application id "com.adobe.photoshop" |
|
do javascript jsxCode |
|
end tell |
|
end if |
|
|
|
-- 4. アクティブレイヤーの名前を Keyboard Maestro の変数で上書き |
|
tell application id "com.adobe.photoshop" |
|
set name of current layer of current document to myLN |
|
end tell</string> |
|
<key>TimeOutAbortsMacro</key> |
|
<true/> |
|
<key>TrimResults</key> |
|
<true/> |
|
<key>TrimResultsNew</key> |
|
<true/> |
|
<key>UseText</key> |
|
<true/> |
|
</dict> |
|
</array> |
|
<key>TimeOutAbortsMacro</key> |
|
<true/> |
|
</dict> |
|
</array> |
|
<key>CreationDate</key> |
|
<real>683471164.55709195</real> |
|
<key>ModificationDate</key> |
|
<real>774708776.80095696</real> |
|
<key>Name</key> |
|
<string>UTL:レイヤーリネーム</string> |
|
<key>Triggers</key> |
|
<array> |
|
<dict> |
|
<key>FireType</key> |
|
<string>Pressed</string> |
|
<key>KeyCode</key> |
|
<integer>15</integer> |
|
<key>MacroTriggerType</key> |
|
<string>HotKey</string> |
|
<key>Modifiers</key> |
|
<integer>0</integer> |
|
</dict> |
|
</array> |
|
<key>UID</key> |
|
<string>F7845850-5FA2-4473-9011-7CBB3E5C4E41</string> |
|
</dict> |
|
</array> |
|
<key>Modifiers</key> |
|
<integer>4096</integer> |
|
<key>Name</key> |
|
<string>PhotoshopPalettesWindow1</string> |
|
<key>PaletteUnderMouse</key> |
|
<true/> |
|
<key>Targeting</key> |
|
<dict> |
|
<key>Targeting</key> |
|
<string>Included</string> |
|
<key>TargetingApps</key> |
|
<array> |
|
<dict> |
|
<key>BundleIdentifier</key> |
|
<string>com.adobe.Photoshop</string> |
|
<key>Match</key> |
|
<string>BundleID</string> |
|
<key>Name</key> |
|
<string>Adobe Photoshop 2025</string> |
|
<key>NewFile</key> |
|
<string>/Applications/Adobe Photoshop 2025/Adobe Photoshop 2025.app</string> |
|
</dict> |
|
</array> |
|
</dict> |
|
<key>Theme</key> |
|
<dict> |
|
<key>Columns</key> |
|
<integer>2</integer> |
|
<key>Opacity</key> |
|
<integer>100</integer> |
|
<key>UseDefaultInstead</key> |
|
<false/> |
|
<key>UseTitle</key> |
|
<false/> |
|
<key>UseTrigger</key> |
|
<true/> |
|
</dict> |
|
<key>ToggleMacroUID</key> |
|
<string>5C291F3F-311F-4124-8CF1-0A58B1A84E09</string> |
|
<key>UID</key> |
|
<string>14905F45-EEE3-4F58-A39D-9D85F7F4D603</string> |
|
</dict> |
|
</array> |
|
</plist> |