Hello,
my programming in MS works fine and I am implementing a sort of debug mode to give the operator / user frequent status information about what is going on besides writing this to a log file.
But when opening non-model MacroScheduler message boxes I find no way how I can close them again.
Is there something similar to IEClose related to MacroScheduler message boxes? I found nothing in the docs or in the forum.
The only way I could think of would be by via an image search and then pressing the button but that's kind of crazy and time consuming also.
Best regards
Heinz57
How to programmatically close a message box
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to programmatically close a message box
You can use CloseWindow:
CloseWindow>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to programmatically close a message box
I very often use message boxes for debugging and also just monitoring the progress of a completed script. I will often start a script with something similar to:
Then as the code progresses, at points where I want to know certain variable values, I will use SetControlText> to put the information in the message box for display. For example:
You could just issue the Message> command over and over with different messages and visually get the same result. The reason to use SetControlText> is to prevent the message window from acquiring focus.
As Marcus pointed out you can programmatically close the message window using:
Then reopen it at any time using:
Code: Select all
Let>msg_xpos=10
Let>msg_ypos=10
Let>msg_width=500
Let>msg>height=300
Message>
Code: Select all
SetControlText>Macro Scheduler Message,TMemo,1,Cycle Count=%Cycle_Count%
As Marcus pointed out you can programmatically close the message window using:
Code: Select all
CloseWindow>Macro Scheduler Message
Code: Select all
Message>
-
- Junior Coder
- Posts: 28
- Joined: Wed Jul 22, 2015 6:10 pm
- Location: A Berliner just east of Wien
Re: How to programmatically close a message box
@Mr. Tettmar
I beg your pardon but I forgot to mention in my OP that I hat tried CloseWindow>Macro Scheduler Message before and it did not work for me.
I now used it again only to find out that the exe aborts with an error when there is no such window. Since one can never be sure if the user has closed the message box, this is no solution.
I think the only proper solution would be to return a handle when creating a box very much like in IECreate. This handle could then be used to close the box and this operation should not crash if the window had been closed before.
@JRL
Thank you for this clever proposal. I will consider using it (later, currently busy with more urgent tasks). But I currently tend to delegate this to my main application, which will soon run as the master process and start MS scripts as needed. But this will only really work with the SDK.
I beg your pardon but I forgot to mention in my OP that I hat tried CloseWindow>Macro Scheduler Message before and it did not work for me.
I now used it again only to find out that the exe aborts with an error when there is no such window. Since one can never be sure if the user has closed the message box, this is no solution.
I think the only proper solution would be to return a handle when creating a box very much like in IECreate. This handle could then be used to close the box and this operation should not crash if the window had been closed before.
@JRL
Thank you for this clever proposal. I will consider using it (later, currently busy with more urgent tasks). But I currently tend to delegate this to my main application, which will soon run as the master process and start MS scripts as needed. But this will only really work with the SDK.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to programmatically close a message box
You could do:
This would only work for a NON modal message box of course.
Code: Select all
IfWindowOpen>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?