Here's what I've have:
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "SP_Photoshop"
-- **************************************************
-- General information about this script
-- **************************************************
SP_Photoshop = {}
function SP_Photoshop:Name()
return "Photoshop"
end
function SP_Photoshop:Version()
return "5.0"
end
function SP_Photoshop:Description()
return "Launch Photoshop application"
end
function SP_Photoshop:Creator()
return "Simple Scriptor, 2014"
end
function SP_Photoshop:UILabel()
return("Photoshop")
end
-- **************************************************
-- The guts of this script
-- **************************************************
function SP_Photoshop.getOS()
if os.getenv("OS") ~= nil
then
local opSys = string.lower(string.sub(os.getenv("OS"), 1, 3))
if opSys == "win" then
return "win"
else
return "unix"
end
else
return "unix"
end
end
function SP_Photoshop:Run(moho)
if (moho.layer:LayerType() ~= MOHO.LT_IMAGE)
then
LM.GUI.Alert(LM.GUI.ALERT_INFO, "This Script only works with Image Layers.", nil, nil, "OK", nil, nil)
return
end
moho:LayerAsImage(moho.layer)
image = (moho.layer:SourceImage())
if(SP_Photoshop.getOS()=="win") then
os.execute(' "Photoshop" "C:\Program Files (x86)\Adobe\Photoshop Elements 5.0\PhotoshopElementsEditor.exe" ' .. '"' .. image .. '"') --WINDOWS - EDIT path to Photoshop according to your system.
else
os.execute("Photoshop" .. image .."&") --LINUX & Mac - edit path "Photoshop" if it doesn't work.
end
LM.GUI.Alert(LM.GUI.ALERT_INFO, "Press 'OK' to reload image when you're done.", nil, nil, "OK", nil, nil)
moho.layer:SetSourceImage(image)
end