help to solve problem
Posted: Wed Aug 18, 2021 6:55 pm
hi I am newbie in moho scripting. and I cant find good resource for learning. I do some script before in other softs.
please help me to learn.
in this simple code i have 2 problem
1 . after press button moho message for create group you must first name it !
2 .line82 attempt to index field mohox (a nil value).
I want just return frame number.
and I want do this with call a function with press button..
and what is 'moho' into prentices.
please help me to learn.
in this simple code i have 2 problem
1 . after press button moho message for create group you must first name it !
2 .line82 attempt to index field mohox (a nil value).
I want just return frame number.
and I want do this with call a function with press button..
and what is 'moho' into prentices.
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "bbb"
-- **************************************************
-- General information about this script
-- **************************************************
bbb = {}
function bbb:Name()
return self:Localize('UILabel')
end
function bbb:Version()
return '1.0'
end
function bbb:UILabel()
return self:Localize('UILabel')
end
function bbb:Creator()
return 'bbb'
end
function bbb:Description()
return self:Localize('Description')
end
function bbb:ColorizeIcon()
return true
end
-- **************************************************
-- Is Relevant / Is Enabled
-- **************************************************
function bbb:IsRelevant(moho)
return true
end
function bbb:IsEnabled(moho)
return true
end
-- **************************************************
-- bbbDialog
-- **************************************************
local bbbDialog = {}
bbbDialog.BUTTON_1 = MOHO.MSG_BASE
function bbbDialog:new()
local d = LM.GUI.SimpleDialog(bbb:Localize('UILabel'), bbbDialog)
local l = d:GetLayout()
d.button1Button = LM.GUI.Button(bbb:Localize('Button 1'), d.BUTTON_1)
l:AddChild(d.button1Button, LM.GUI.ALIGN_LEFT, 0)
return d
end
function bbbDialog:HandleMessage(msg)
if msg == self.BUTTON_1 then
bbb:nnnnn()
else
end
end
-- **************************************************
-- The guts of this script
-- **************************************************
function bbb:nnnnn(moho)
local mohox = moho
local dlog = bbbDialog:new(moho)
dlog:DoModeless()
frameN = self.mohox.frame
print(frameN)
end
function bbb:Run(moho)
local dlog = bbbDialog:new(moho)
dlog:DoModeless()
moho.document:SetDirty()
moho.document:PrepUndo(nil)
end
-- **************************************************
-- Localization
-- **************************************************
function bbb:Localize(text)
local phrase = {}
phrase['Description'] = ''
phrase['UILabel'] = 'bbb'
phrase['Button 1'] = 'Button 1'
local fileWord = MOHO.Localize("/Menus/File/File=File")
if fileWord == "Файл" then
phrase['Description'] = ''
phrase['UILabel'] = 'bbb'
phrase['Button 1'] = 'Button 1'
end
return phrase[text]
end