Saturday, August 18, 2007, 7:16:04 AM, Neil wrote: NH> April White: >> a suggested patch to the OpenSelected() method so that if the selected >> text is a directory, the 'open dialog' appears. NH> Why would someone want this?
In SciTe-Ru Pack IDM_OPENSELECTED command is replaced on lua a script. As against the IDM_OPENSELECTED command, that works only with obviously set path and relative path, the script processes variables SciTE, variable environments, designs LUA. So, for example, it is possible to open a file if the path to it is set down so: $(SciteDefaultHome)\tools\RunReg.js Or so: %APPDATA%\Opera\Opera\profile\opera6.ini Or so: props["SciteDefaultHome"].."\\tools\\Zoom.lua" It is possible to modify this script to gain, if necessary, dialogue of opening of a file in the set directory. Source: > ----------------------------------------------------------------- -- Open_Selected_Filename.lua -- mozers™, vladvro -- version 1.2 --------------------------------------- -- Connection: -- In file SciTEStartup.lua add a line: -- dofile (props["SciteDefaultHome"].."\\tools\\Open_Selected_Filename.lua") --------------------------------------- local function Open_Selected_Filename() local filename if editor.Focus then filename = editor:GetSelText() else filename = output:GetSelText() end local foropen = nil -- Example: $(SciteDefaultHome)\tools\RunReg.js local pattern_sci = '^$[(](.-)[)]' local _, _, scite_var = string.find(filename,pattern_sci) if scite_var ~= nil then foropen = string.gsub(filename, pattern_sci, props[scite_var]) else -- Example: %APPDATA%\Opera\Opera\profile\opera6.ini local pattern_env = '^[%%](.-)[%%]' local _, _, os_env = string.find(filename, pattern_env) if os_env ~= nil then foropen = string.gsub(filename, pattern_env, os.getenv(os_env)) else -- Example: props["SciteDefaultHome"].."\\tools\\Zoom.lua" local pattern_props = '^props%[%p(.-)%p%]%.%.%p(.*)%p' local _, _, scite_prop1, scite_prop2 = string.find(filename,pattern_props) if scite_prop1 ~= nil then foropen = props[scite_prop1]..scite_prop2 end end end if foropen ~= nil then foropen = string.gsub(foropen, '\\\\', '\\') scite.Open (foropen) return true end end -- Add user event handler OnMenuCommand local old_OnMenuCommand = OnMenuCommand function OnMenuCommand (msg, source) local result if old_OnMenuCommand then result = old_OnMenuCommand(msg, source) end if msg == 103 then --IDM_OPENSELECTED if Open_Selected_Filename() then return true end end return result end -- mozers <http://scite.ruteam.ru> _______________________________________________ Scite-interest mailing list Scite-interest@lyra.org http://mailman.lyra.org/mailman/listinfo/scite-interest