--======================= CE Form to Lua ========================-- function TranslateToFunction(tbl, Str, parent) if (type(Str) ~= 'string') then error('Not valid type'); end; local action = 'create' .. string.gsub(Str, 'TCE', '') -- Easy solution.. if ( Str == 'TTabSheet' and parent and object_getClassName(parent) == 'TCEPageControl') then if tbl=="" then action = parent.getName() .. '.addTab()'; else action = tbl .. parent.getName() .. '.addTab()'; end end return action end local scrlPg1 = false local scrlPg2 = [==[ ----------------------- ComponentClass ScrollBox ----- function createTScrollBox(Parent) local cnt = createComponentClass('TScrollBox', Parent) cnt.Parent = Parent return cnt end load("return registerLuaFunctionHighlight('createTScrollBox')")() ------------------------- ]==] local chkbx1 = false local chkbx2 = [==[ ----------------------- CheckBox Colors ----- function setCheckBoxColors(chk,clr,fclr) executeCodeLocalEx('uxtheme.SetWindowTheme', chk.handle, "", "") chk.Color = clr chk.Font.Color = fclr end load("return registerLuaFunctionHighlight('setCheckBoxColors')")() ------------------------- ]==] function CETrainerToLua() function GenerateLuaScript(WantedForm,tbl) Form = WantedForm FormToLua = {} FormToLua.MainForm = {} CompCount = Form.getComponentCount() FormToLua.MainForm.name = Form.getName() FormToLua.MainForm.caption = Form.Caption FormToLua.MainForm.height = Form.Height FormToLua.MainForm.width = Form.Width FormToLua.MainForm.left = Form.Left FormToLua.MainForm.top = Form.Top FormToLua.MainForm.Popupmode = Form.Popupmode --and '0' or false FormToLua.MainForm.Position = Form.Position FormToLua.MainForm.BorderStyle = Form.BorderStyle or false FormToLua.MainForm.enabled = tostring(Form.Enabled) FormToLua.MainForm.visible = control_getVisible(Form) and 'true' or 'false' for i=1,CompCount do i = i-1 FormToLua[i] = {} Object = Form.getComponent(i) --if Object.Parent.getName()==FormToLua.MainForm.name then FormToLua[i].Object_parent = Object.Parent.getName() FormToLua[i].Object_name = Object.getName() or false if tbl~="" then FormToLua[i].Object_name = tbl.."."..Object.getName() or false FormToLua[i].Object_type = TranslateToFunction(tbl, object_getClassName(Object), Object.Parent) or error("No object type???"); if Object.Parent.getName()==FormToLua.MainForm.name then FormToLua[i].Object_parent = Object.Parent.getName() else FormToLua[i].Object_parent = tbl.."."..Object.Parent.getName() end else FormToLua[i].Object_name = Object.getName() or false FormToLua[i].Object_type = TranslateToFunction("", object_getClassName(Object), Object.Parent) or error("No object type???"); end FormToLua[i].Object_clsname = object_getClassName(Object) or false FormToLua[i].Object_autoSize = Object.AutoSize and 'true' or 'false' or false FormToLua[i].Object_autoScroll = Object.AutoScroll and 'true' or 'false' or false FormToLua[i].Object_height = Object.Height or false FormToLua[i].Object_width = Object.Width or false FormToLua[i].Object_left = Object.Left or false FormToLua[i].Object_top = Object.Top or false FormToLua[i].Object_caption = Object.caption or false FormToLua[i].Object_text = Object.Text or false FormToLua[i].Object_alignment = Object.Alignment or false FormToLua[i].Object_enabled = Object.Enabled and 'true' or false FormToLua[i].Object_visible = control_getVisible(Object) and 'true' or false FormToLua[i].Object_scrollBars = Object.ScrollBars or false FormToLua[i].Object_wordWrap = Object.WordWrap and 'true' or 'false' or false FormToLua[i].Object_readOnly = Object.ReadOnly and 'true' or 'false' or false FormToLua[i].Object_style = Object.Style or false FormToLua[i].Object_itemIndex = Object.ItemIndex or false FormToLua[i].IsTab = object_getClassName(Object) == 'TTabSheet'; FormToLua[i].Object_Stretch = Object.Stretch and 'true' or 'false' or false FormToLua[i].Object_fontSize = tostring(Object.Font.Size) -- Or this.. FormToLua[i].Object_fontStyle = Object.Font.Style and "" or false FormToLua[i].Object_color = Object.color or false FormToLua[i].Object_fontcolor = Object.Font.Color or false end GenerateScript = [[if ]] .. FormToLua.MainForm.name .. [[ then ]] .. FormToLua.MainForm.name .. [[.Destroy() ]] .. FormToLua.MainForm.name .. [[=nil end]] .. [[ ]] .. [[DP1=getScreenDPI()/96]] .. [[ ]] .. FormToLua.MainForm.name .. [[=createForm() ]] .. [[ ]] .. FormToLua.MainForm.name .. [[.height=]].. FormToLua.MainForm.height .. [[*DP1 ]] .. FormToLua.MainForm.name .. [[.width=]].. FormToLua.MainForm.width .. [[*DP1 ]] .. FormToLua.MainForm.name .. [[.left=]].. FormToLua.MainForm.left .. [[*DP1 ]] .. FormToLua.MainForm.name .. [[.top=]].. FormToLua.MainForm.top .. [[*DP1]] .. [[ ]] .. FormToLua.MainForm.name .. [[.PopupMode=0]] .. [[ ]] .. FormToLua.MainForm.name .. [[.caption="]] .. FormToLua.MainForm.caption .. [["]] .. [[ ]] .. FormToLua.MainForm.name .. [[.Position="poDesktopCenter"]] .. [[ ]] .. FormToLua.MainForm.name .. [[.ShowInTaskBar="stAlways"]] .. [[ ]] .. FormToLua.MainForm.name .. [[.BorderStyle="bsSingle"]] .. [[ ]] .. [[--[==[ ]] .. [[ ]] .. FormToLua.MainForm.name .. [[.BorderStyle="bsNone"]] .. [[ ]] .. FormToLua.MainForm.name .. [[.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )]] .. [[ ]] .. FormToLua.MainForm.name .. [[.Color=0x000100]] .. [[ ]] .. [[Object.OnMouseDown=function() ]] .. FormToLua.MainForm.name .. [[.DragNow() end]] .. [[ ]] .. [[--]==] ]] .. [[ ]] .. [[-------------------------]] for line in string.gfind (GenerateScript,"[^\n]+") do print(line) end TempText = [[-- Creating the objects]] if tbl~="" then TempText = [[local ]]..tbl..[[ = {}]] else TempText = [[-- Creating the objects]] end for i = 1, CompCount do i = i-1 if FormToLua[i].Object_clsname=="TScrollBox" then if scrlPg1==false then TempText = TempText .. scrlPg2 scrlPg1=true end end if FormToLua[i].Object_clsname=="TCECheckBox" then if chkbx1==false then TempText = TempText .. chkbx2 chkbx1=true end end TempText = TempText ..[[ ]] .. [[----------------------- ]] .. FormToLua[i].Object_name .. [[ -----]] .. [[   ]] .. (FormToLua[i].IsTab and FormToLua[i].Object_name .. [[=]] .. FormToLua[i].Object_type or FormToLua[i].Object_name .. [[=]] .. FormToLua[i].Object_type .. [[(]] .. FormToLua[i].Object_parent .. [[)]]) .. [[ ]] .. ((FormToLua[i].Object_autoSize == false) and '' or FormToLua[i].Object_name .. [[.AutoSize=]] .. FormToLua[i].Object_autoSize) .. [[ ]] .. ((FormToLua[i].Object_height == false) and '' or FormToLua[i].Object_name .. [[.height=]] .. FormToLua[i].Object_height) .. [[*DP1 ]] .. ((FormToLua[i].Object_width == false) and '' or FormToLua[i].Object_name .. [[.width=]] .. FormToLua[i].Object_width) .. [[*DP1 ]] .. ((FormToLua[i].Object_left == false) and '' or FormToLua[i].Object_name .. [[.left=]] .. FormToLua[i].Object_left) .. [[*DP1 ]] .. ((FormToLua[i].Object_top == false) and '' or FormToLua[i].Object_name .. [[.top=]] .. FormToLua[i].Object_top) .. [[*DP1 ]] .. [[ ]] .. ((FormToLua[i].Object_caption == false) and '' or FormToLua[i].Object_name .. [[.caption=]] .. [["]] .. FormToLua[i].Object_caption.. [["]]) .. [[ ]] .. ((FormToLua[i].Object_text == false) and '' or FormToLua[i].Object_name .. [[.text=]] .. [["]] .. FormToLua[i].Object_text.. [["]]) .. [[ ]] .. ((FormToLua[i].Object_alignment == false) and '' or FormToLua[i].Object_name .. [[.alignment=]] .. [["]] .. FormToLua[i].Object_alignment.. [["]]) if FormToLua[i].Object_type~="createImage" then TempText = TempText ..[[ ]] .. ((FormToLua[i].Object_fontStyle == false) and '' or FormToLua[i].Object_name .. [[.Font.Style="fsBold"]]) .. [[ ]] .. ((FormToLua[i].Object_fontSize == false) and "10" or FormToLua[i].Object_name .. [[.Font.Size=]] .. FormToLua[i].Object_fontSize) .. [[*DP1 ]] end if FormToLua[i].Object_type=="createMemo" then TempText = TempText ..[[ ]] .. ((FormToLua[i].Object_scrollBars == false) and '' or FormToLua[i].Object_name .. [[.ScrollBars=]] .. [["]] .. FormToLua[i].Object_scrollBars.. [["]]) .. [[ ]] .. ((FormToLua[i].Object_wordWrap == false) and '' or FormToLua[i].Object_name .. [[.wordWrap=]] .. FormToLua[i].Object_wordWrap) end if FormToLua[i].Object_type=="createImage" then TempText = TempText ..[[ ]] .. ((FormToLua[i].Object_Stretch == false) and '' or FormToLua[i].Object_name .. [[.Stretch=]] .. [[]] .. FormToLua[i].Object_Stretch) end if FormToLua[i].Object_type=="createComboBox" then TempText = TempText ..[[ ]] .. ((FormToLua[i].Object_readOnly == false) and '' or FormToLua[i].Object_name .. [[.ReadOnly=]] .. FormToLua[i].Object_readOnly) .. [[ ]] .. ((FormToLua[i].Object_style == false) and '' or FormToLua[i].Object_name .. [[.Style=]] .. [["]] .. FormToLua[i].Object_style) .. [["]] .. [[ ]] .. ((FormToLua[i].Object_itemIndex == false) and '0' or FormToLua[i].Object_name .. [[.ItemIndex=0]]) end if FormToLua[i].Object_clsname=="TCECheckBox" then TempText = TempText .. [[ setCheckBoxColors(]] .. FormToLua[i].Object_name .. [[,]] .. FormToLua[i].Object_color .. [[,]] .. FormToLua[i].Object_fontcolor .. [[) ]] end if FormToLua[i].Object_clsname=="TScrollBox" then TempText = TempText .. [[ ]] .. FormToLua[i].Object_name .. [[.AutoScroll=]] .. FormToLua[i].Object_autoScroll .. [[ ]] end TempText = TempText ..[[ ----------------------- ]] end for line in string.gfind (TempText,"[^\n]+") do if (line~= '' and #line > 1) then print(line); end end aa_end = [[ --############################################################################-- --############################################################################-- ]] print(aa_end) Form.Name = Form.Name .. "2" end function Start() if CEToLua then CEToLua.Destroy() CEToLua=nil end CEToLua = createForm() CEToLua.height = 35 CEToLua.width = 270 CEToLua.caption = "Convert CE Trainers to LUA scripts" CEToLuaButton = createButton(CEToLua) CEToLuaButton.caption = "Generate" CEToLuaButton.height = 26 CEToLuaButton.width = 80 CEToLuaButton.top = 4 CEToLuaButton.left = 188 CEToLuaEdit = createEdit(CEToLua) CEToLuaEdit.AutoSize=false CEToLuaEdit.height=25 CEToLuaEdit.width=95 CEToLuaEdit.left=2 CEToLuaEdit.top=5 CEToLuaEdit.Text="" CEToLuaEdit.TextHint="FormName?" CEToLuaEdit1 = createEdit(CEToLua) CEToLuaEdit1.AutoSize=false CEToLuaEdit1.height=25 CEToLuaEdit1.width=85 CEToLuaEdit1.left=100 CEToLuaEdit1.top=5 CEToLuaEdit1.Text="" CEToLuaEdit1.TextHint="Table?" CEToLuaButton.onClick = function () a = CEToLuaEdit.Text tbl = CEToLuaEdit1.Text loadstring([[test = (]] .. a .. [[ or nil) ]])() a = nil if (type(test)~="userdata") then test = nil CEToLuaEdit.Caption = "" showMessage("Sorry but this is not a valid form!") return end GenerateLuaScript(test,tbl) test = nil CEToLua.hide() end CEToLua.centerScreen() function CETrainerToLua() if CEToLua.getVisible() then CEToLua.hide() else CEToLua.show() end end CEToLua.OnClose = CETrainerToLua end Start() end --############################################################################-- function ColorCntPanel2() if clrPltte then clrPltte.Destroy() clrPltte=nil end DP1=getScreenDPI()/96 clrPltte=createForm() clrPltte.height=352*DP1 clrPltte.width=380*DP1 clrPltte.left=457*DP1 clrPltte.top=197*DP1 clrPltte.PopupMode=0 clrPltte.caption="clrPltte" clrPltte.Position="poDesktopCenter" clrPltte.ShowInTaskBar="stAlways" clrPltte.BorderStyle="bsNone" clrPltte.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA ) clrPltte.Color=0x000100 ------------------------- local pltbl = {} ---------------------- Panel Button Effect -------- function createBtnpanel(owner,clr) obj1=createPanel(owner) obj1.Color = clr obj1.Cursor = -21 obj1.OnMouseMove = function() obj1.Color = tonumber(clr) - 4000 end obj1.OnMouseLeave = function() obj1.Color = clr end obj1.OnMouseDown = function() obj1.Color = tonumber(clr) - 8000 end obj1.OnMouseUp = function() obj1.Color = clr end return obj1 end ---------------------- ----------------------- pltbl.clmn1 -----  pltbl.clmn1=createPanel(clrPltte) pltbl.clmn1.AutoSize=false pltbl.clmn1.height=34*DP1 pltbl.clmn1.width=370*DP1 pltbl.clmn1.left=5*DP1 pltbl.clmn1.top=5*DP1 pltbl.clmn1.caption="Color Palette" pltbl.clmn1.Cursor = -22 pltbl.clmn1.Color=0xFF98CB pltbl.clmn1.Font.Style="fsBold" pltbl.clmn1.Font.Size=14*DP1 pltbl.clmn1.OnMouseDown=function() clrPltte.DragNow() end ----------------------- ----------------------- pltbl.clbtn1 -----  pltbl.clbtn1=createBtnpanel(pltbl.clmn1,0xFF9898) pltbl.clbtn1.AutoSize=false pltbl.clbtn1.height=24*DP1 pltbl.clbtn1.width=25*DP1 pltbl.clbtn1.left=5*DP1 pltbl.clbtn1.top=5*DP1 pltbl.clbtn1.caption="--" pltbl.clbtn1.alignment="2" pltbl.clbtn1.Font.Style="fsBold" pltbl.clbtn1.Font.Size=12*DP1 ----------------------- ----------------------- pltbl.clbtn2 -----  pltbl.clbtn2=createBtnpanel(pltbl.clmn1,0xFF9898) pltbl.clbtn2.AutoSize=false pltbl.clbtn2.height=24*DP1 pltbl.clbtn2.width=25*DP1 pltbl.clbtn2.left=340*DP1 pltbl.clbtn2.top=5*DP1 pltbl.clbtn2.caption="X" pltbl.clbtn2.alignment="2" pltbl.clbtn2.Font.Style="fsBold" pltbl.clbtn2.Font.Size=12*DP1 ----------------------- ----------------------- pltbl.clmn2 -----  pltbl.clmn2=createPanel(clrPltte) pltbl.clmn2.AutoSize=false pltbl.clmn2.height=263*DP1 pltbl.clmn2.width=370*DP1 pltbl.clmn2.left=5*DP1 pltbl.clmn2.top=43*DP1 pltbl.clmn2.color=clDefault pltbl.clmn2.alignment="2" pltbl.clmn2.Font.Style="fsBold" pltbl.clmn2.Font.Size=0*DP1 ----------------------- ----------------------- pltbl.clmn3 -----  pltbl.clmn3=createPanel(clrPltte) pltbl.clmn3.AutoSize=false pltbl.clmn3.height=39*DP1 pltbl.clmn3.width=370*DP1 pltbl.clmn3.left=5*DP1 pltbl.clmn3.top=310*DP1 pltbl.clmn3.color=0xFF98CB pltbl.clmn3.alignment="2" pltbl.clmn3.Font.Style="fsBold" pltbl.clmn3.Font.Size=0*DP1 ----------------------- ----------------------- pltbl.clbtn3 -----  pltbl.clbtn3=createPanel(pltbl.clmn3) pltbl.clbtn3.AutoSize=false pltbl.clbtn3.height=27*DP1 pltbl.clbtn3.width=110*DP1 pltbl.clbtn3.left=130*DP1 pltbl.clbtn3.top=6*DP1 pltbl.clbtn3.caption="COLORS" pltbl.clbtn3.Cursor = -21 pltbl.clbtn3.color=clDefault pltbl.clbtn3.Font.Style="fsBold" pltbl.clbtn3.Font.Size=10*DP1 ----------------------- ----------------------- pltbl.cled1 -----  pltbl.cled1=createEdit(pltbl.clmn3) pltbl.cled1.AutoSize=false pltbl.cled1.height=27*DP1 pltbl.cled1.width=120*DP1 pltbl.cled1.left=5*DP1 pltbl.cled1.top=6*DP1 pltbl.cled1.text="" pltbl.cled1.alignment="taCenter" pltbl.cled1.Font.Style="fsBold" pltbl.cled1.Font.Size=11*DP1 ----------------------- ----------------------- pltbl.cled2 -----  pltbl.cled2=createEdit(pltbl.clmn3) pltbl.cled2.AutoSize=false pltbl.cled2.height=27*DP1 pltbl.cled2.width=120*DP1 pltbl.cled2.left=245*DP1 pltbl.cled2.top=6*DP1 pltbl.cled2.text="" pltbl.cled2.alignment="taCenter" pltbl.cled2.Font.Style="fsBold" pltbl.cled2.Font.Size=11*DP1 ----------------------- --=======================================================-- --=======================================================-- local abs, floor = math.abs, math.floor local function hsv2rgb (h, s, v) local c = s * v local x = c * (1 - abs ((h / 60) % 2 - 1)) local m = v - c local cases = { { c, x, 0 }, { x, c, 0 }, { 0, c, x }, { 0, x, c }, { x, 0, c }, { c, 0, x } } local rgb = {} for _, colour in ipairs (cases [floor (h / 60) + 1]) do rgb [#rgb + 1] = (colour + m) * 255 end return rgb end local function rgb_to_hex(rgb) local r, g, b = floor(rgb[1]), floor(rgb[2]), floor(rgb[3]) return string.format("0x%02X%02X%02X", r, g, b) end local function palette (v_start, v_end, v_step, h_start, h_step) local h_steps = floor (360 / abs (h_step)) local plt = {} for v = v_start, v_end, v_step do local gray = (v - v_start) / (v_end - v_start) local s = 1 if v > 1 then s = s - (v - 1) v = 1 end local row = {} for h = h_start, h_start + h_step * (h_steps - 1), h_step do row [#row + 1] = hsv2rgb (h % 360, s, v) end -- Grays: row [#row + 1] = hsv2rgb (0, 0, gray) plt [#plt + 1] = row end return plt end local as_in_clrtbl = palette (0.2, 1.8, 0.2, 240, -30) local cltbl2 = {} for i, row in ipairs(as_in_clrtbl) do for j, color in ipairs(row) do local hex_color = rgb_to_hex(color) fmtrgb = string.format("%s", hex_color) cltbl2 [#cltbl2 + 1] = fmtrgb --print(fmtrgb) end end --=======================================================-- --=======================================================-- local pn = {} local lf1 = 10 local tp1 = 10 local ix = 1 local pln = 1 local fntidx = 1 function pnls1(clr,idx) pn["pne"..idx] = createPanel(pltbl.clmn2) pn["pne"..idx].Height=25 pn["pne"..idx].Width=25 pn["pne"..idx].Left=lf1 pn["pne"..idx].Top=tp1 pn["pne"..idx].BevelWidth=2 pn["pne"..idx].Color=clr pn["pne"..idx].OnClick=function(sender) if fntidx==1 then pltbl.clbtn3.Color = sender.Color else pltbl.clbtn3.Font.Color = sender.Color end pltbl.cled1.text = sender.Color pltbl.cled2.text = clr end end function clrpnl() for l,k in pairs(cltbl2) do if l == #cltbl2 then pnls1("0xFFFFFF",ix) else pnls1(k,ix) end ix = tonumber(ix) + 1 lf1 = tonumber(lf1) + 27 if ix==14 then pln = tonumber(pln) + 1 tp1 = tonumber(tp1) + 27 lf1 = 10 ix = 1 end end end pltbl.cled1.OnClick=function() writeToClipboard(pltbl.cled1.Text) end pltbl.cled2.OnClick=function() writeToClipboard(pltbl.cled2.Text) end pltbl.clbtn3.OnClick=function() if fntidx==1 then fntidx=2 else fntidx=1 end end pltbl.clbtn1.OnClick=function() clrPltte.WindowState = "wsMinimized" end pltbl.clbtn2.OnClick=function() clrPltte.Close() end clrpnl() end --############################################################################-- scrn = MainForm.frmAutoInject.Assemblescreen function crtCCScBox() scrn.Lines.Add("----------------------- ComponentClass ScrollBox -----") scrn.Lines.Add("function createTScrollBox(Parent)") scrn.Lines.Add(" local cnt = createComponentClass('TScrollBox', Parent)") scrn.Lines.Add(" cnt.Parent = Parent") scrn.Lines.Add(" return cnt") scrn.Lines.Add("end") scrn.Lines.Add("-------------------------") registerLuaFunctionHighlight('createTScrollBox') end function crtChkBoxClr() scrn.Lines.Add("----------------------- CheckBox Colors -----") scrn.Lines.Add("function setCheckBoxColors(chk)") scrn.Lines.Add(" return executeCodeLocalEx('uxtheme.SetWindowTheme', chk.handle, '', '')") scrn.Lines.Add("end") scrn.Lines.Add("-------------------------") print("--Use:") print("setCheckBoxColors(UDF1.CECheckbox1)") print("UDF1.CECheckbox1.Color = clWhite") print("UDF1.CECheckbox1.Font.Color = 0x0000ff") registerLuaFunctionHighlight('setCheckBoxColors') end function effChkBoxClr() scrn.Lines.Add([[----------------------- CheckBox Colors Effect-----]]) scrn.Lines.Add([[function chkcolors(chk1,clron,clroff,cpt,cptopt)]]) scrn.Lines.Add([[executeCodeLocalEx('uxtheme.SetWindowTheme', chk1.handle, "", "")]]) scrn.Lines.Add([[chk1.AutoSize = true]]) scrn.Lines.Add([[chk1.Font.Color=clroff chk1.Cursor = -21]]) scrn.Lines.Add([[ ]]) scrn.Lines.Add([[ chk1.OnClick=function(sender)]]) scrn.Lines.Add([[ if cptopt==1 then]]) scrn.Lines.Add([[ if sender.State==1 then]]) scrn.Lines.Add([[ sender.Caption = cpt1 .. " (ON!)"]]) scrn.Lines.Add([[ else]]) scrn.Lines.Add([[ sender.Caption = cpt1 .. " (OFF!)"]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ else]]) scrn.Lines.Add([[ if sender.State==1 then]]) scrn.Lines.Add([[ sender.Caption = cpt1 .. " "]]) scrn.Lines.Add([[ else]]) scrn.Lines.Add([[ sender.Caption = cpt1]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ ]]) scrn.Lines.Add([[ chk1.OnChangeBounds=function(sender)]]) scrn.Lines.Add([[ if sender.state==1 then]]) scrn.Lines.Add([[ sender.Font.Color = clron]]) scrn.Lines.Add([[ else]]) scrn.Lines.Add([[ sender.Font.Color = clroff]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ end]]) scrn.Lines.Add([[ if cptopt==1 then chk1.Caption=cpt1.." (OFF!)" else chk1.Caption=cpt end]]) scrn.Lines.Add([[end]]) print("--Use: Name, Color, Font Color, Caption, Change Caption: 1=ON!-OFF!, 0 no change..") print("chkcolors(UDF1.CECheckbox1,clBlack,clRed,'Hack 1',1)") print("chkcolors(UDF1.CECheckbox2,clBlack,0x0000FF,'Hack 2',0)") end function crtAddTmr() local crtstr = "" crtstr = inputQuery('Timer Name', 'Please enter a name for the Timer:', crtstr) if not crtstr then return end scrn.Lines.Add("----------------------------") scrn.Lines.Add("if " .. crtstr .. " then " .. crtstr .. ".Destroy() " .. crtstr .. "=nil end") scrn.Lines.Add("") scrn.Lines.Add(crtstr .. "=createTimer()") scrn.Lines.Add(crtstr .. ".Interval=1000") scrn.Lines.Add(crtstr .. ".Enabled=false -- true") scrn.Lines.Add("") scrn.Lines.Add(crtstr .. ".OnTimer=function()") scrn.Lines.Add("") scrn.Lines.Add("end") scrn.Lines.Add("----------------------------") end function pnlefcbtn() scrn.Lines.Add("---------------------- Panel Button Effect --------") scrn.Lines.Add("function createBtnpanel(owner,clr)") scrn.Lines.Add("obj1=createPanel(owner)") scrn.Lines.Add("obj1.Color=clr obj1.Cursor = -21") scrn.Lines.Add(" obj1.OnMouseMove = function()") scrn.Lines.Add(" obj1.Color = tonumber(clr) - 4000") scrn.Lines.Add(" end") scrn.Lines.Add(" obj1.OnMouseLeave = function()") scrn.Lines.Add(" obj1.Color = clr") scrn.Lines.Add(" end") scrn.Lines.Add(" obj1.OnMouseDown = function()") scrn.Lines.Add(" obj1.Color = tonumber(clr) - 8000") scrn.Lines.Add(" end") scrn.Lines.Add(" obj1.OnMouseUp = function()") scrn.Lines.Add(" obj1.Color = clr") scrn.Lines.Add(" end") scrn.Lines.Add(" return obj1") scrn.Lines.Add("end") scrn.Lines.Add("----------------------") print("-- use: -----------> Owner , panel color") print("pnl1 = createBtnpanel(UDF1,9180234)") print("pnl2 = createBtnpanel(UDF1,0xffff00)") registerLuaFunctionHighlight('createBtnpanel') end lsmenu = MainForm.frmAutoInject.Menu.Items if frmtolua then frmtolua.Destroy() frmtolua=nil end frmtolua = createMenuItem(lsmenu) frmtolua.Caption = ('CEFormToLUA') menuItem_add(lsmenu,frmtolua) miChld1=createMenuItem(frmtolua) menuItem_setCaption(miChld1, "Create Timer") miChld1.Images = lsmenu.aaImageList miChld1.ImageIndex = 8 menuItem_add(frmtolua, miChld1) menuItem_onClick(miChld1, crtAddTmr) miChld2=createMenuItem(frmtolua) menuItem_setCaption(miChld2, "ScrollBox Class") miChld2.Images = lsmenu.aaImageList miChld2.ImageIndex = 8 menuItem_add(frmtolua, miChld2) menuItem_onClick(miChld2, crtCCScBox) miChld3=createMenuItem(frmtolua) menuItem_setCaption(miChld3, "Checkbox Colors") miChld3.Images = lsmenu.aaImageList miChld3.ImageIndex = 8 menuItem_add(frmtolua, miChld3) menuItem_onClick(miChld3, crtChkBoxClr) miChld4=createMenuItem(frmtolua) menuItem_setCaption(miChld4, "EffectCheckbox Colors") miChld4.Images = lsmenu.aaImageList miChld4.ImageIndex = 8 menuItem_add(frmtolua, miChld4) menuItem_onClick(miChld4, effChkBoxClr) miChld5=createMenuItem(frmtolua) menuItem_setCaption(miChld5, "Button Panels") miChld5.Images = lsmenu.aaImageList miChld5.ImageIndex = 8 menuItem_add(frmtolua, miChld5) menuItem_onClick(miChld5, pnlefcbtn) miChld6=createMenuItem(frmtolua) menuItem_setCaption(miChld6, "Color Palette") miChld6.Images = lsmenu.aaImageList miChld6.ImageIndex = 5 menuItem_add(frmtolua, miChld6) menuItem_onClick(miChld6, ColorCntPanel2) miChld7=createMenuItem(frmtolua) menuItem_setCaption(miChld7, "Form to Lua") miChld7.Images = lsmenu.aaImageList miChld7.ImageIndex = 5 menuItem_add(frmtolua, miChld7) menuItem_onClick(miChld7, CETrainerToLua) --===========================================--