> JScript (WSH) version:
> // OpenSciTESession.js
> // Run SciTE with the loadsession option, with path correctly quoted
> if (WScript.Arguments.count() == 1)
> {
>     var path = WScript.Arguments.Item(0);
>     path = path.replace(/\\/g, '\\\\');
>     var shell = WScript.CreateObject("WScript.Shell");
>     var sysEnv = shell.Environment("SYSTEM");
>     var sciteHome = sysEnv("SciTE_HOME");
>     shell.Exec(sciteHome + "\\SciTE.exe \"-loadsession:" + path + "\"");
> }
> # SciTEses.reg
> Windows Registry Editor Version 5.00
> [HKEY_CLASSES_ROOT\.ses]
>  <at> ="SciTESessionFile"
> [HKEY_CLASSES_ROOT\SciTESessionFile]
> ; English
>  <at> ="SciTE Session File"
> ; French
>  <at> ="Session SciTE"
> [HKEY_CLASSES_ROOT\SciTESessionFile\DefaultIcon]
>  <at> ="C:\\Program Files\\UText\\SciTE\\SciTE.exe"
> [HKEY_CLASSES_ROOT\SciTESessionFile\shell\open\command]
> ; The following doesn't work because backslashes in path must be escaped
> #~  <at> ="\"C:\\Program Files\\UText\\SciTE\\SciTE.exe\" \"-loadsession:%L\""
>  <at> ="CScript.exe \"C:\\Program Files\\UText\\SciTE\\OpenSciTESession.js\" 
> \"%L\""

Here is a Lua version (without making use of an environment variable though). 
You will need the Lua stand-alone binary and edit the paths below appropriately 
in order to invoke it.

-- loadsession.lua ------------------------------------------------------------

local sesFile = string.gsub(arg[1], "\\", "\\\\")
os.execute("c:\\tools\\win\\scite\\scite.exe \"-loadsession:"..sesFile.."\"")

-- load_session_files.reg -----------------------------------------------------

REGEDIT4
[HKEY_CLASSES_ROOT\.ses]
  @="SciTESessionFile"
[HKEY_CLASSES_ROOT\SciTESessionFile]
  @="SciTE Session File"
[HKEY_CLASSES_ROOT\SciTESessionFile\DefaultIcon]
  @="c:\\tools\\win\\scite\\scite.exe"
[HKEY_CLASSES_ROOT\SciTESessionFile\shell\open\command]
  @="c:\\tools\\dev\\lua\\lua.exe c:\\tools\\win\\scite\\scripts\\loadsession.
lua \"%L\""

Huseyin Kilic


_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to