Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Exit editor without saving anything

37 views
Skip to first unread message

J. David Boyd

unread,
Mar 6, 2025, 9:45:01 AMMar 6
to SemWare TSE Pro Text Editor
Forgive me if this has been gone over before, didn't see anything in my quick perusal of our archives.

I keep a few TSE windows open throughout the day as scratchpads, and at the end of the day I'd like to be able to close them without being prompted to save them.  And often I have 10-20 windows open in  a TSE window.  (Playing around with SQL, storing code snippets temporarily, etc).

Is there a command built in to blow out of the editor, without saving anything?    Or an internal command to clear all the buffer modified flags, and then exit?

Thanks for any information y'all might have, or that I've overlooked!

Dave

--
What's so funny about peace, love, and understanding? 

Joe Berry

unread,
Mar 6, 2025, 10:18:25 AMMar 6
to SemWare TSE Pro text editor

I  use the Carlo Hogoveen macro AbanName.  The TSE function is

AbandonEditor() Terminates the editor without any prompt, discarding all unsaved changes to files.
Regards,
Joe

knud van eeden

unread,
Mar 6, 2025, 10:45:02 AMMar 6
to SemWare TSE Pro text editor
> I keep a few TSE windows open throughout the day as scratchpads,

A.

1. That should means thus if you start your Microsoft Task Manager (e.g. run taskmgr.exe in a cmd.exe box) that you should see more than one 'The Semware Editor' entries (see screenshot with 2 TSEs running at the same time)

Inline image

2. So basically I would say there are more than 1 independent TSE processes running at the same time.

3. So what you want is to used one of these processes, thus one 'The Semware Editor (32 bit)' process to stop all the other (independent) processes.

4. As far as I know and can assume that is not possible out of the box.

5. The common factor is that all those Microsoft windows with TSE running in it all have the string 'TSE Pro' in it (see screenshot 2)

6. So my initial approach would be to use Microsoft Windows API and something like this:

a. WHILE a Microsoft window with title 'TSE Pro' is found on your computer
b.  IF yes, found, then CLOSE (=e.g. kill that process) that Microsoft window with that title 'TSE Pro'
c. ENDWHILE

7. Note: The backside of this is that it will not first save unsaved files, as it will simply kill that process.

B. 
dOtherwise using something like a program like 'AutoHotKey' which can automate such clicking with the mouse and pressing
keys to do similar, but then also giving the possibility in that TSE to save open files before closing that TSE.

with friendly greetings
Knud van Eeden


Inline image





--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/semware/bc6081f5-c446-4d9b-bfdf-8a909f94fec5n%40googlegroups.com
.

H P

unread,
Mar 6, 2025, 1:07:25 PMMar 6
to sem...@googlegroups.com
Well, if you want to kill tse pro processes all without saving all just make a batch file or type in a dosbox; taskkill /f /im g32.exe
this will kill all tse gui processes use e32.exe instead of g32.exe for the console version.
If you have both running; taskkill /f /im g32.exe /im e32.exe.


Met vriendelijke groet,
With kind regards,
Muy atentamente,
Mit Freundliche Gruß,
Sinceramente,


H. Pikaar

Henri...@gmail.com



Op do 6 mrt 2025 om 16:45 schreef 'knud van eeden' via SemWare TSE Pro text editor <sem...@googlegroups.com>:

gregg conklin

unread,
Mar 6, 2025, 4:57:07 PMMar 6
to sem...@googlegroups.com
This macro/dll combo has served me well for the last ~15 years. I do the same with countless editors open. I still use the console version, but assume it will translate to the gui version. Though, I seriously doubt for the Linux version.

You'll have to compile the .c code to make the dll.


You may want to alter the macro .s code to AbandonEditor() instead of Exit() to not prompt for saving. You may also want to name all of the files "scratch-<timestamp>" or something and only AbandonFile() those, and then call Exit() to prevent data loss on non-scratch buffers.

Bonus. I use this batch file to start TSE with a timestamped notes file when no params given.

c:\tse32\mymac\tseshutdown>type C:\bat\q.cmd (yes, q, from the before times)
@echo off

IF "%1"=="" GOTO WithTimestamp

START c:\tse32\e32.exe %*
EXIT /B

:WithTimestamp
    For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
    For /f "tokens=1-2 delims=/: " %%a in ("%TIME%") do (set mytime=%%a%%b)

    START c:\tse32\e32.exe e:\docs\notes\notes-%mydate%_%mytime%.txt




Carlo Hogeveen

unread,
Mar 6, 2025, 5:15:46 PMMar 6
to sem...@googlegroups.com

One way is to assign a key to AbandonEditor() in your .ui file.
<CtrlShift X> AbandonEditor()

Alternatively, nowadays TSE comes with the Execute macro, which is also part of TSE's Potpourri menu.
You can use it to interactively execute AbandonEditor().
When Execute is started without parameters it remembers its commands in its own history.

Carlo



knud van eeden

unread,
Mar 6, 2025, 5:29:09 PMMar 6
to sem...@googlegroups.com
Thus running this TSE macro from within one of the TSE windows is one of the simplest solutions.

It will kill *all* TSE windows automatically without saving, including the one in which you are running this.

---

PROC Main()
 Dos( "taskkill /f /im g32.exe", _DONT_PROMPT_ | _DONT_WAIT_ )
END

---

with friendly greetings
Knud van Eeden

S.E. Mitchell

unread,
Mar 6, 2025, 5:29:59 PMMar 6
to sem...@googlegroups.com
If you open the menus, and go to the left of the File menu, there is:

Select Quick Exit. It isn't so quick if you have changed files - it
prompts you one last time (just once, not for each file) if you want
to quit all of them.



As others have said, you can also assign AbandonEditor() to a keystroke:

<CtrlAltShift q> AbandonEditor()
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/semware/CAJf-FgY3-Bw7ziv%3D6FDQp-qR%3DjdcZpv%2BBiBZQ5pzttg3oM4AdQ%40mail.gmail.com.
image.png
image.png

knud van eeden

unread,
Mar 7, 2025, 7:25:18 AMMar 7
to SemWare TSE Pro Text Editor
Another method which will close automatically all open one or more TSE windows + also asking to save changed files before exiting.

1. Start e.g. 4 TSE windows (see screenshot) and create some unsaved changes in one of those TSE windows

2. Make sure in Windows 'taskbar settings' to select 'combine taskbar buttons' (=Always, Hide labels) (see screenshot)

3. Then all your 2 or more TSE windows will be combined into 1 icon on the Windows taskbar (see screenshot)

4. Then right click with your mouse on that TSE icon and select and click on 'Close all windows' (see screenshot)

5. That will close automatically all 4 TSE windows, including asking to save any unsaved files where applicable in any of those TSE windows.

6. It will thus ask to save any changes in that one TSE window only, all other TSE windows are already closed.

7. In general thus a more general solution to closing all TSE windows as it also includes asking to save any unsaved changes.

with friendly greetings
Knud van Eeden

Inline image


Inline image

Inline image

Inline image

Inline image

--

knud van eeden

unread,
Mar 7, 2025, 10:58:48 AMMar 7
to SemWare TSE Pro text editor
 Q. TSE: How to create a program that does not close the current TSE window but closes all other TSE windows and asks also if saving changes? Method: Microsoft Windows API + enumerating the titles of all windows and searching for the substring 'TSE Pro' in those windows titles.

1. -Assumed is that this TSE program is the best solution in general (selective closing by excluding the current running TSE and also not losing unintentionally changes in files).

2. -How was it created? Using artificial intelligence (=AI)

     Tried first DeepSeek (too many issues, hanging, so skipped)

     then ChatGPT (still issues, so skipped)

     then finally Claude Sonnet version 3.7. That worked.

3. -Prompt used:

"
Create a The Semware Editor Professional SAL program using Microsoft Windows API to do the following:

WHILE a Microsoft window with where in part of the title the string 'TSE Pro' is found on your computer
 IF found, then CLOSE (=kill that process) that Microsoft window with that title 'TSE Pro'
ENDWHILE
"

4. -This TSE program was created which:

     1. -Will NOT close the CURRENT TSE window in which you run this TSE program.

     2. -Will close all other (TSE) windows with the string 'TSE Pro' in the title.

     3. -If there are any changes in those other TSE windows it will ask the
         user if those changes should be saved.

5. -Tested successfully on
    Microsoft Windows 10 Professional (64 bits)
    running
    TSE version 4.50 RC24

6. -The program (see also attachment 'WindowTseOtherCloseAllAskSave.s')

with friendly greetings
Knud van Eeden

--- cut here: begin --------------------------------------------------

 /*
  * Close TSE Pro Windows
  *
  * This SAL program for TSE Pro uses the Windows API to find and close
  * any windows that contain "TSE Pro" in their title.
  */

 #define WM_CLOSE      0x0010    // Windows message constant for closing a window
 #define GW_HWNDNEXT   2         // GetWindow command to get next window
 #define GW_HWNDFIRST  0         // GetWindow command to get first child window

 // Windows API function declarations
 dll "<user32.dll>"
     integer proc GetWindow(integer hwnd, integer uCmd): "GetWindow"
     integer proc GetDesktopWindow(): "GetDesktopWindow"
     integer proc GetTopWindow(integer hWnd): "GetTopWindow"
     integer proc SendMessage(integer hwnd, integer msg, integer wParam, integer lParam): "SendMessageA"
     integer proc GetWindowText(integer hwnd, var string lpString, integer nMaxCount): "GetWindowTextA"
     integer proc IsWindow(integer hwnd): "IsWindow"
     integer proc GetWindowThreadProcessId(integer hwnd, var integer lpdwProcessId): "GetWindowThreadProcessId"
     integer proc IsWindowVisible(integer hwnd): "IsWindowVisible"
 end

 dll "<kernel32.dll>"
     integer proc GetCurrentProcessId(): "GetCurrentProcessId"
 end

 // Main procedure
 proc Main()
     integer hwnd = 0              // Window handle
     integer nextHwnd = 0          // Next window handle
     integer windowClosed = FALSE  // Flag to track if any window was closed
     integer procId = 0            // Process ID
     integer ourProcId = 0         // Our process ID
     string windowTitle[255] = ""  // Window title buffer
     integer closedCount = 0       // Count of closed windows
     integer foundAny = FALSE      // Flag to track if any windows were found
     integer skipWindow = FALSE    // Flag to check if we should skip current window

     // Get our own process ID to avoid closing our own windows
     ourProcId = GetCurrentProcessId()

     // Display initial message
     // Warn("Searching for TSE Pro windows...")

     // Start with no windows closed
     windowClosed = FALSE

     // Loop until no more windows are closed
     repeat
         // Reset flag for this iteration
         windowClosed = FALSE

         // Get desktop window first, then the first top-level window
         hwnd = GetDesktopWindow()
         hwnd = GetTopWindow(hwnd)
         // Warn("First hwnd: " + Str(hwnd))

         // Loop through all top-level windows
         while hwnd <> 0
             // Save next window handle before potentially closing this one
             nextHwnd = GetWindow(hwnd, GW_HWNDNEXT)

             // Default is to process this window
             skipWindow = FALSE

             // Skip if window is not visible
             if not IsWindowVisible(hwnd)
                 skipWindow = TRUE
             endif

             // Check if it's our own window
             if not skipWindow
                 // Get window's process ID
                 GetWindowThreadProcessId(hwnd, procId)

                 // Skip our own process windows
                 if procId == ourProcId
                     skipWindow = TRUE
                 endif
             endif

             // Process window if not skipped
             if not skipWindow
                 // Get the window title
                 windowTitle = ""
                 GetWindowText(hwnd, windowTitle, sizeof(windowTitle))

                 // Debug message to show what windows we're examining
                 // Warn("Checking window: '" + windowTitle + "' (handle: " + Str(hwnd) + ")")

                 // Check if the window title contains "TSE Pro", using case-insensitive search
                 if length(windowTitle) > 0 and (pos("TSE Pro", windowTitle) > 0 or pos("tse pro", windowTitle) > 0)
                     // Found a TSE Pro window
                     foundAny = TRUE

                     // Display message about closing the window
                     // Warn("Found TSE Pro window: '" + windowTitle + "', closing...")

                     // Send WM_CLOSE message to the window
                     SendMessage(hwnd, WM_CLOSE, 0, 0)

                     // Wait a bit to let the window close
                     // delay(100)  // Increased delay for better reliability

                     // Check if window was closed
                     if not IsWindow(hwnd)
                         windowClosed = TRUE
                         closedCount = closedCount + 1
                         // Warn("Window closed successfully.")
                     else
                         Warn("Failed to close window.")
                     endif

                     // Break out of the window loop to restart the search
                     // This is needed because window handles may change after closing a window
                     break
                 endif
             endif

             // Move to the next window
             hwnd = nextHwnd
         endwhile
     until not windowClosed

     // Final message
     if foundAny
         if closedCount > 0
             Warn("Closed " + str(closedCount) + " TSE Pro window(s).")
         else
             Warn("Found TSE Pro windows but failed to close them.")
         endif
         PurgeMacro( CurrMacroFilename() )
     else
         Warn("No TSE Pro windows found.")
     endif
 end

--- cut here: end ----------------------------------------------------



WindowTseOtherCloseAllAskSave.s

knud van eeden

unread,
Mar 7, 2025, 12:16:13 PMMar 7
to SemWare TSE Pro Text Editor
> And often I have 10-20 windows open in a TSE window.  (Playing around with SQL, storing code snippets temporarily, etc).

Note:

According to this information it should thus be 10 or more windows inside one and the *same* TSE window.
That is assumed to be pretty crammed inside (see screenshots 1 and 2 as illustration).

In that case see the remarks about AbandonEditor() and so on.

Therefore it was assumed that different g32.exe (e.g. 10) were separately started each (see screenshot 3),
thus *different* (independent) TSE windows as that gives more space to work with the ideas.

In that case see the (TSE) examples created.


with friendly greetings
Knud van Eeden


a. 16 vertical windows within one TSE window (see screenshot)

b. 16 horizontal windows within one TSE window (see screenshot)

c. 16 independent cascaded TSE windows (see screenshot)

Inline image

Inline image

Inline image



On Thursday, March 6, 2025 at 03:45:10 PM GMT+1, J. David Boyd <jdavi...@gmail.com> wrote:


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

knud van eeden

unread,
Mar 7, 2025, 12:33:12 PMMar 7
to SemWare TSE Pro Text Editor
> And often I have 10-20 windows open in a TSE window.  (Playing around with SQL, storing code snippets temporarily, etc).

Otherwise it would be probably maybe mean that e.g. 16 files were opened in the TSE ring (and then 
switching between those files using <Next File> and <Previous Fie>).

Then each of those files has the full TSE window canvas to its disposition (so maximizing 
screen area for each individual file).


Inline image


J. David Boyd

unread,
Mar 8, 2025, 6:08:24 AMMar 8
to sem...@googlegroups.com
Thanks for the (overwhelming) response!   🙂

I believe that setting a key to AbandonEditor should do exactly what I need.    Thanks for all the advice.

This help is one more reason the TSE is the best editor out there, bar none!  (Thanks again Sammy!)

Dave

J. David Boyd

unread,
Mar 9, 2025, 7:35:39 AMMar 9
to sem...@googlegroups.com
Both situations occur.  

When I am using TSE to create a powershell or SQL script, I edit, then save, and run it.   I never keep the editor open when I am running the script I wrote.  Mostly because I run SQL in SQL Management Studio and Powershell either in a powershell window (to observer) or in Visual Studio Code (to debug).  

So I never worry about having files I need to save in my accumulated left over TSEs at the end of the day.   And sometimes I might have 10-20 separate TSE windows open, sometimes its only 1 or 2 or 5 with 10-15 buffers/windows open within each.

So I've read through all the suggestions, and came up with 2 techniques.  
1. Since I use Take Command, and live in a TCC window to do almost everything, I made a TCC .btm file that runs the mentioned taskkill command to remove all the running TSE sessions.
2. I found the file quickxit.s in the MAC directory, and stole the mAbandon snippet out of it.   I added that to one of my already loading personal macro files, and assigned it to CtrlAltShift X.

Now I can easily blow away a TSE if I am in it, or if I am at the command line and notice how many I have running.

Wouldn't have known about these 2 great ways to blow out TSE without the help of everyone here, so all my thanks again!  You all are the best support team for any software I've ever used.

Dave




Reply all
Reply to author
Forward
0 new messages