Associating Scite .session files with "scite.exe -loadsession:" poses a problem in Windows because of the backslashes in the file path. To avoid this, copy this script to the Scite directory and associate it with .session files instead. Then you can double-click on a .session file in any project directory and it will be loaded in SciTe.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# script to load SciTe .session files by double-clicking them in Windows Explorer # the .session file type must be present and its 'open" command associated with : # "/path/to/python.exe" "/path/to/scite.py" "%1" # NOTE: /path/to/scite.py MUST be the same as /path/to/scite.exe ! # Example : # "c:\python\python.exe" "c:\program files\wscite\wscite.py" "%1" import sys, os, subprocess # argv is the full path to where this python script was launched from # it must be in the same directory as the SciTe executable ! # argv is the full path to the scite session file we want to load script, sessionpath = sys.argv # this gives us the path to the scite executable scite = script[:-2] + 'exe' # this gives us the basename of the session file and the directory it is in sessiondir, sessionname = os.path.split(sessionpath) # here we switch to the session file dir and launch scite with just the file name as the loadsession parm subprocess.Popen([scite, "-loadsession:%s" % sessionname], cwd = sessiondir) # script ends without waiting for command completion
Scite has an option to automatically reload the last used session, but if you frequently switch from one project to another it is more practical to have a .session file for each project in its own directory.
Associating these files to scite.exe in Windows Explorer doesn't work because scite.exe does not escape the backslash character in paths passed to the -loadsession: command parameter.
The workaround here is to change to the project directory first (deduced from the session file path), then launch scite.exe (found using the script path) with the -loadsession: option and only the session file name.