Id like to be able to select a layer with the move tool by clicking on its sprite then, activate a script, then select a second layer with the move tool and have BOTH layers selected. This would allow me to avoid moving my mouse to the layer menu and clicking on the white circle. I tried several scripts written by AI but no luck
function init(plugin)
plugin:newCommand{
id="quick_select_second_layer",
title="Quick Select Second Layer",
group="layer",
onclick=function()
local sprite = app.activeSprite
if not sprite then
app.alert("No active sprite!")
return
end
-- Store the first selected layer
local firstLayer = app.activeLayer
if not firstLayer then
app.alert("No active layer!")
return
end
app.alert("First layer selected: " .. firstLayer.name)
-- Inform the user to manually select the second layer
app.alert("Now manually click on the sprite to select the second layer")
-- Wait for a short period to allow user to select the layer
app.timers:add(5000, function() -- 5000 milliseconds = 5 seconds
local secondLayer = app.activeLayer
if not secondLayer or secondLayer == firstLayer then
app.alert("No valid second layer selected!")
return
end
-- Select both layers
app.range.layers = {firstLayer, secondLayer}
app.alert("Both layers selected: " .. firstLayer.name .. " and " .. secondLayer.name)
end)
end
}
end
function exit(plugin)
end