Here is the whole script:
Code: Select all
--[[ Script name ]]
ScriptName = "Syn_Addons"
--[[ General info ]]
Syn_Addons = {}
function Syn_Addons:Name()
return "Add-ons"
end
function Syn_Addons:Version()
return "1.0"
end
function Syn_Addons:Description()
return "Add-on management"
end
function Syn_Addons:Creator()
return "SynthSin75"
end
function Syn_Addons:UILabel()
return "Add-ons"
end
--[[ Recurring values ]]
Syn_Addons.tlpath = ""
Syn_Addons.bpath = ""
function Syn_Addons:AssignTLP()
local path = LM.GUI.OpenFile("Select ...scripts\\tool\\_tool_list.txt")
end
function Syn_Addons:LoadPrefs(prefs)
self.bpath = prefs:GetString("Syn_Addons.bpath", "")
end
function Syn_Addons:SavePrefs(prefs)
prefs:SetString("Syn_Addons.bpath", self.bpath)
end
--[[ Main body ]]
function Syn_Addons:IsEnabled(moho)
return true
end
function Syn_Addons:Run(moho) -- function start
--initial path UI stuff
if (self.bpath == nil or self.bpath == "") then -- first if start
check1 = LM.GUI.Alert(LM.GUI.ALERT_INFO, "Syn_Addons needs to know where your tool list is located.", "Please navigate to '...Anime Studio\\scripts\\tool\\_tool_list.txt'", nil, "OK", "Cancel", nil)
if (check1 == 1)then -- second if start
return
else -- part of second if needs no end
local path = LM.GUI.OpenFile("Select ...scripts\\tool\\_tool_list.txt")
if (path == "")then -- third if start
return
elseif (string.sub(path, -14) == "_tool_list.txt") then
self.tlpath = path
elseif (path ~= "" or nil) then
while (string.sub(path, -14) ~= "_tool_list.txt") do -- while start
check2 = LM.GUI.Alert(LM.GUI.ALERT_INFO, "Wrong file.", "Please select again.", nil, "OK", "Cancel", nil)
if (check2 == 1) then -- fourth if start
break
elseif (check2 == 0) then
local path = LM.GUI.OpenFile("Select ...scripts\\tool\\_tool_list.txt")
if (path == "") then -- fifth if start
return
elseif (string.sub(path, -14) == "_tool_list.txt") then
self.tlpath = path
break
end -- fifth if end
end -- fourth if end
end -- while end
end -- third if end
end -- second if end
--end -- first if end
if (self.tlpath ~= nil) then
if (string.sub(self.tlpath, -14) == "_tool_list.txt") then
local path = string.sub(self.tlpath, 1, - 28)
if (path ~= "") then
self.bpath = path
end
end
end
if (self.tlpath ~= nil) then
print(self.tlpath)
end
if (self.bpath ~= nil) then
print(self.bpath)
end
end -- function end