require "Gelo" require "RudraScript" RudraRunner = {} RudraRunner.default_rudradir = ProgDir..'Scripts\\RudraScript\\' function RudraRunner:runscript(ext) local tabURL = tab.url local tabSource = tab.source if extbar.getval('button[name="clearlog"]') == 'True' then tab:clearlog() end Rudra.Set_CustomLibName('Sandcat') Rudra.Redirect_IO(true) Rudra.Import_Globals(false) script = extbar.getval('plaintext[name="script"]') extbar.setattrib('button[name="run"]','disabled','True') tab.statusbartext = 'Executing script...' if ext == 'js' then javascript(script) end if ext == 'pas' then pascalscript(script) end if ext == 'rem.pas' then rempascal(script) end if ext == 'pl' then perl(script) end if ext == 'php' then php(script) end if ext == 'py' then python(script) end if ext == 'rb' then ruby(script) end if ext == 'vbs' then vbscript(script) end extbar.setattrib('button[name="run"]','disabled','') tab.statusbartext = 'Done.' Rudra.Import_Globals(true) end function RudraRunner:openlua() extbar.setattrib('button[name="run"]','disabled','') local f = extbar.getval('select[name="scriptlist"]') local fcontents = '' if file_exists(self.default_rudradir..f) then fcontents = file_gettostr(self.default_rudradir..f) end extbar.setval('plaintext[name="script"]',fcontents) end function RudraRunner:get_scriptlist(ext) local p = GStrListParser:new() local flist = GStrList:new() local l = file_getdirfiles(self.default_rudradir..'*.'..ext) p:loadfromstr(l) while p:parsing() do flist:add('') end local result = flist.text flist:release() p:release() return result end function RudraRunner:loadscript(package,script) local code = browser.readfile(package,script) extbar.setval('plaintext[name="script"]',code) end function RudraRunner:vieweditor(lang_name,lang_ext,script,scbxname) local defaultscript = [[]] local example_menuitems = browser.readfile('Syhunt.scx','Examples/Menu_'..lang_name..'.html') local html = [[
|
External Scripts: (Place your .]]..lang_ext..[[ scripts in ]]..ProgDir..[[Scripts\RudraScript\)
Available Variables: tabURL = contains the tab URL tabSource = contains the tab source Notes: Print functions will print the text to the Log tab [?] Any errors will be logged in the Error Console. |