0

How do you close the GNU-Octave editor programmatically in Windows?

Either the whole editor or a specific .m file being edited.

Felipe Jiménez
  • 453
  • 3
  • 9
  • Interesting ... why would you want to do that? – Tasos Papastylianou May 07 '21 at 15:01
  • Marking exams. Want an automated fast way to close all open mfiles of a student to go on with the next. (I already have a script that opens all the next student's mfiles.) – Felipe Jiménez May 07 '21 at 15:47
  • 1
    right, so, just to clarify, your marking is manual, but you'd like an easy way to close all currently open windows, right? Is there a reason you prefer this to be programmatic rather than a keyboard shortcut? – Tasos Papastylianou May 07 '21 at 17:59
  • To integrate everything in a single script. – Felipe Jiménez May 07 '21 at 18:30
  • 1
    You're being very laconic, hahah, but ok. I'll make lots of possibly wrong assumptions about your process instead as a starting point. If your marking process is one of running a script that effectively does "edit student1code.m student1output.m student1report.m", then marking manually, then having to close those three editor windows one by one and run your script again, then there is a way to make the "close all three windows" happen with a single shortcut. I think having to press two keys instead of one two switch back to the terminal to run the command isn't that much loss in automation. – Tasos Papastylianou May 07 '21 at 18:34
  • 1
    If this is not your process, then unfortunately I don't think there _is_ a programmatic way to manipulate Qt4 elements that are not specifically catered for in the octave language. (remember, the octave language is primarily intended to be run in a terminal -- the gui is an extra layer). However, there is nothing stopping you from creating input from windows via something like https://github.com/ebranlard/xdotool-for-windows which presses the keyboard shortcut for you, and then proceeds to 'type' in your command window, effectively running the next script for you. – Tasos Papastylianou May 07 '21 at 18:36
  • 1
    Honestly I think this is a bit overkill just to save yourself from pressing a shortcut though. I mean, even if you don't use the mouse and you use something like Ctrl-0 to switch to the command window to start typing your script, I don't think typing Shift-Ctrl-F4 Ctrl-0 instead is such a big sacrifice ... – Tasos Papastylianou May 07 '21 at 18:39
  • No, it's clearly not a big thing, but sometimes people just know a simple command thas does a trick. I'd create a script that closes all files of a student, moves to the next, and opens theirs for marking. In this case simulating keyboard input is a bit of an overkill. Thank you anyway. – Felipe Jiménez May 08 '21 at 08:07
  • 1
    No worries, yeah no such simple command that I'm aware of. The only thing I would say is, if you are unable to set a shortcut from the properties menu, try exporting the shortcuts, finding the relevant entry and setting it in the file, and then importing that file again from the shortcuts menu. This gives you access to all the possible keyboard shortcuts, including "close all tabs" and "close all tabs except current". If your first tab is the 'loading script', you could probably 'close all except current' and then 'run'. that's as automated as it gets I think. – Tasos Papastylianou May 08 '21 at 13:39

0 Answers0