Force window to iconise
Alan Adams (2486) 1149 posts |
I would like to find a way for one program to tell another program to iconise its window. Im my complex software system, which you might recall me mentioning before, some of the networked computers start up with no mouse or keyboard. However the code contains a lot of *report commands. While I can turn these off, whenever a BASIC error occurs it gets reported, which causes the reporter window to re-open if it has been closed. If !Reporter is not running then the *report commands produce their own error and those programs then quit. (There’s one part of the code which uses a combination of ON ERROR LOCAL and ON ERROR OFF to tolerate an error which is expected, as it is testing whether a variable exists.) I have two possible solutions: 1 Don’t run !Reporter at startup, and go through about 25 programs and about 20 libraries and replace all the “*report” commands with “*X report” 2 Iconise the !Reporter window However without a mouse present there doesn’t seem a way to do option 2 without using VNC. Can part of my software startup cause !Reporter to iconise? (Or I suppose, force its window off-screen or behind the backdrop) |
Alan Adams (2486) 1149 posts |
I’m pettry sure I’ve done this before – I think it’s a WindowOpen message. Just checked one thing – when !Reporter updates its window, it doeesn’t pull it back on-screen, which would have beeen a problem. |
Stuart Swales (8827) 1357 posts |
|
Alan Adams (2486) 1149 posts |
I know how to identify a task by name, but not how to find the window handle for it’s (only) window.
Brilliantly simple, except I need to do that for all the reporter commands, e.g. reportmem, reporterror etc. First test: Having aliased report, it encountered a |
Rick Murray (539) 13840 posts |
Does that not end up in a loop? Maybe: |
Stuart Swales (8827) 1357 posts |
Thanks – edited the original in case droids from the future come back and do some AI CopyPasta |
Alan Adams (2486) 1149 posts |
That’s fixed it. Thanks guys Now using
The reportmem command now displays in the Reporter window an error “not in BASIC”, but I can live with that. It doesn’t stop the program, and if Reporter isn’t running (which is the purpose of all this) nothing adverse happens. |
Alan Adams (2486) 1149 posts |
It’s rather fortunate that I agreed to talk to WROCC about this setup this week, because I want to demo it without all the diagnostic output (which slows it down). Without the talk, in a month when it goes live at a competition, I might have hit this at a very inconvenient point. Serendipity-doo-dah-day |
Alan Adams (2486) 1149 posts |
I wrote too soon. The fact that the reportmem command when aliased said “not in BASIC” should have alerted me to the fact that that Reporter does some very devious stuff. It turns out that normally When aliased So it seems that when aliased, Reporter is looking in the alias environment, not in the BASIC one, so doesn’t work. |
Alan Adams (2486) 1149 posts |
So a new version of the question: How do I get StrongED to do a search and replace on all the BASIC files in a folder, replacing “*report” with “*X report” ? |
Alan Adams (2486) 1149 posts |
I’ve never used Zap. I don’t think Edit can do a batch operation like this. In StrongED I could drop all the files onto StrongED and it will open all of them. Then use shift-F4 to open search and replace on the first, set it up and do replace-all, then close and save. Then use shift-F4 again, choose previous (to get the previously used search and rellace items) and repeat. For over 50 files. Notepad++ on Windows makes it easier, but obviously can’t handle BASIC files on RISC OS. |
Stuart Swales (8827) 1357 posts |
There isn’t an environment in which an alias runs – it is always expanded to text and then that is run instead of the original command. The problem with *Report here is that it’s not expecting to have been run from the X utility, so that global replace in BASIC won’t help. You can open all the files in Edit in the same fashion as StrongEd (hardly doing it as a batch properly, is it?) |
Alan Adams (2486) 1149 posts |
Ah. I hadn’t appreciated that X was a utility. At least you’ve saved me trying to do a global edit without messing anything up. Back to the “push the window out of the way” method. |
Stuart Swales (8827) 1357 posts |
Surely that doesn’t help as it will keep reappearing? Would Reporter > Config > Hide window help? |
Alan Adams (2486) 1149 posts |
It does stay iconised while receiving updates – that’s how I often run it.
Hiding it’s too easy – I’d missed that one. Thanks again. I can set that in a boot script. |
Stuart Swales (8827) 1357 posts |
So it does! That’s useful to know, as I usually close the Reporter window and it pops up again a bit later. Told you I didn’t use iconise ever… |
Rick Murray (539) 13840 posts |
I’ve turned it off entirely on my machines |
Alan Adams (2486) 1149 posts |
Normally I’d agree. But the situation here is that I am using Reporter to produce debugging information. In production operation I turn most (but unfortunetely not all) debugging output off, and I don’t want it visible to users. Nor do I want the empty window visible on screen, even if no debugging is being sent. If Reporter isn’t running then any debug output produces errors that quit my application, which again I don’t want. If I close the Reporter window, the next output to it pops it up at the front of the stack. Putting the window out of sight is the best compromise. I can’t find a way to force the window to iconise without using the mouse (and some computers don’t have a mouse attached), so I either force it off-screen, which is possible, or use the facility in Reporter to hide the window. On a computer where I am able to use the mouse, iconising works perfectly well, but I can’t get the computer to start up like that. |
Stuart Swales (8827) 1357 posts |
Perhaps it’s a suggestion to Andrew R for Pinboard 2 development? |
Alan Adams (2486) 1149 posts |
It showed up while I was preparing a demonstration, but the real problem will come when it’s being used in anger. I want to show 5 separate demos of part of the system, and they take time to get going. The idea was to set up each on a different rPi, and use preconnected VNC sessions, then screen sharing in Zoom to show the selected screen. Because VNC is pre-connected, I can sort out the unwanted window in advance, but it’s a headache I don’t need at the actual event. The rPi’s don’t have screen, mouse or keyboard, because there isn’t space for all that here. I’m using this as an opportunity to get an image of the rPi SD card so I can easily clone the cards, which for the actual event, will be used in at least 8 rPi’s. |
Martin Avison (27) 1494 posts |
I am away from home atm (hence my late arrival to this), so only have VRPC to run RISC OS. |
Steve Pampling (1551) 8170 posts |
Most systems use keep-alive packets to prevent that kind of thing. |
David J. Ruck (33) 1635 posts |
If you still want to move windows off screen my WindOpen module is probably the easiest way. |
Alan Adams (2486) 1149 posts |
I’ll try to remember that next time a need arises.
The issue arose because of 2 mistakes in tandem: I had used The combination needed alt-break to stop the looping “abort on data transfer” messages. If I had RTFMed more closely, the questions would not have arisen. The hide option solves my problem. |