SciTE4AutoHotkey sessions vs bookmarks

The popular SciTE-based AutoHotkey Script Editor
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

SciTE4AutoHotkey sessions vs bookmarks

Post by JnLlnd » 15 Nov 2023, 11:14

When launching SciTE4AutoHotkey, it remembers the opened file, bookmark positions, cursor location from the previous session, which is great. Thanks to the developers.

Is it possible to have these settings remembered for various *.session files? I'm using various *.session files to switch from one project to project and would like to find back bookmarks distinctly for each project.

If it is not possible, is there a wish list where I could add this suggestion?

Thanks,
Jean
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: SciTE4AutoHotkey sessions vs bookmarks

Post by JnLlnd » 25 Nov 2023, 17:49

An info I did not mention in my previous message is that I'm loading SciTE4AutoHotkey with various session files using the -loadsession command line parameter, for example:

C:\Program Files\AutoHotkey\SciTE\SciTE.exe "-loadsession:C:\\...\\QuickClipboardEditor\\QuickClipboardEditor.session"?
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: SciTE4AutoHotkey sessions vs bookmarks

Post by JnLlnd » 25 Nov 2023, 17:55

I have this in my SciTEUser.properties file:

Code: Select all

#~ If you set save.session, the list of currently opened buffers will be saved on exit in a session file.
#~ When you start SciTE next time (without specifying a file name on the command line) the last session will be restored automatically.
save.session=1

#~ Setting session.bookmarks causes bookmarks to be saved in session files.
#~ When loading a session file bookmarks are restored.
session.bookmarks=1
This saves the bookmark in the session file. But in the global session file: C:\...\SciTE\SciTE.session:

Code: Select all

buffer.1.path=C:\...\QuickClipboardEditor\QuickClipboardEditor.ahk
buffer.1.position=55
buffer.1.scroll=0
buffer.1.current=1
buffer.1.bookmarks=3 ; <<<
Would it be possible to have the buffer.n.bookmarks= entries saved in both the global session file AND the session file loaded when launching SciTE with the command line parameter -loadsession? I tried adding this in the loaded session file but it had no effect:

Code: Select all

save.session=1
session.bookmarks=1
If this is not possible, a solution would be to launch a script at SciTE exit to copy the settings from the global session file to the "loaded" session file. Is there a way to trigger a script when SciTE exists?
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: SciTE4AutoHotkey sessions vs bookmarks

Post by JnLlnd » 25 Nov 2023, 23:54

Until a better solution is found, I wrote this small script that:

- launches SciTE4Autohotkey loading the session file passed as parameter
- waits for SciTE to quit
- after SciTE quits, copies the global SciTE session file overwriting the session file passed as parameter.

It works well for my needs.

Code: Select all

#SingleInstance Force
#requires AutoHotkey v1.1

strExePath := "C:\Program Files\AutoHotkey\SciTE\SciTE.exe"
strGobalSessionPath := "C:\Users\Jean Lalonde\Documents\AutoHotkey\SciTE\SciTE.session"

if !A_Args.Length()
{
    MsgBox, % "Launch this script with the path of the session file to load as parameter."
    ExitApp
}
else if !FileExist(A_Args.1)
{
    MsgBox, % "Sesson file """ . A_Args.1 . """ not found."
    ExitApp
}

; launch SciTE4AutoHotkey and open the session file and wait for apps exiting
; escape "\" in session file path by doubling them to "\\"
RunWait, % strExePath . " ""-loadsession:" . StrReplace(A_Args.1, "\", "\\") . """"

; remove this confirmation or change the timeout as required
MsgBox, 4, SciTE4AutoHotkey Session, % "Save session to this file?`n`n" . A_Args.1 . " ?", 10 ; 10 seconds timeout processed as Yes
IfMsgBox, No
    ExitApp

; overwrite the loaded session file with the SciTE global session file
FileCopy, % strGobalSessionPath, % A_Args.1, 1 ; 1 to overwrtite
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

Post Reply

Return to “SciTE4AutoHotkey”