Marcus' Macro Blog

Tips and News on Macro Recording and Automating Windows with Macro Scheduler
January 27th, 2009 by Marcus Tettmar

Every now and then, in the forums and in emails to us, there seems to be some confusion over what these terms mean.  As a developer I take these terms for granted, but anyone else, depending on their walk of life, might think they refer to some kind of Modal Jazz; something to do with a modal matrix used in linear algebra; or a type of auxiliary verb used to indicate modality.  

I sometimes need to remind myself that not everyone coming to Macro Scheduler and Windows Automation in general are familiar with geeky software terms.  I can’t tell you much about modal jazz, linear algebra or auxiliary verbs, but I can do my best to set to rest any confusion about Modal and Non-Modal windows.

Modal Windows

When a window is modal it remains active and focused until the user has finished with it and dismisses it.  While it is active no other windows of the same application can be activated.  A modal window is therefore normally a child window.  The user needs to interract with it before control can be returned to the parent application. In effect the parent application is locked and nothing proceeds until the modal window is closed.

You’ll find a good definition of Modal Windows on Wikipedia, here.

Non-Modal Windows

So a non-modal window is the opposite. While it is active you can still activate other windows. The user can switch between windows of the same application. The window being active does not prevent the rest of the application from continuing.

Modal Dialogs

In Macro Scheduler you can create custom dialogs. These can be modal or non-modal to the script. When we refer to a modal dialog what we mean is that once the dialog is displayed, the script halts until the user closes the dialog. Script execution is paused until the dialog is dismissed. The script cannot do any processing while the modal dialog is active. A modal dialog is displayed with the Show command, with a return variable specified, in which the “modal result” of the dialog is reported, corresponding to which button was pressed to close the dialog.

Non-Modal Dialogs

A dialog can be made to be non-modal. In which case the script carries on even after it has displayed the dialog. The user can interact with the dialog while the script continues to perform other tasks. The developer would need to write code to retrieve the state of the dialog and the data that has been entered into it. Usually this would need to take place in a loop. A non-modal dialog is displayed with the Show command, with the return variable omitted. Inside the loop we would retrieve the state and data of the dialog with the GetDialogAction command, and set it with ResetDialogAction.

In this post I have concentrated on definitions rather than going into detail on how you can create and control custom dialogs. That is a subject for another post and you will find more information in the help file and online help. Some dialog examples ship with Macro Scheduler and you’ll find more in the forums.

Related posts:

  1. Windows XP is Dead, Long Live Windows!
  2. It’s a Macro Recorder, It’s a Windows Automation Tool. It’s Macro Scheduler!
  3. Remember The Macro Recorder in Windows 3.1?
  4. Macro Scheduler 14.1 Available

2 Responses to “Modal vs Non-Modal – Windows, Not Jazz”

  1. Brother John says:

    Marcus, Very good explanation of the differences between modal and non-modal windows, and specifically, on how they are used in the control of dialogs. As a programmer, I can tell you I admire your support and the work you do on your most excellent program!

    In fact, I’d like to take just a moment to give you some special praise.

    My wife is extremely physically disabled (a severe form of Muscular Dystrophy) and she now has zero use of her arms and hands. She’s a smart woman with a Master’s degree, but her disease eventually progressed to a point where her voice is now her only tool. After 15 years of faithful service to a company where she worked, she was asked to take early retirement. Thanks to your excellent program, (and her speech recognition software), she has been able to use her education and skills to remain productive! To the extent that she continues having purpose in her life, we owe you much!

    My wife volunteers her services to the company where I work, and she makes good use of your software to remotely control a remote Citrix session into our downtown Philadelphia office. Prior to your program, she was very limited in what she could do once she was remotely connected. Her speech recognition software thought the connection to be made up of a steady stream of graphical images/pictures. It had no way to know that those images were actually supposed to be links, buttons, drop down lists, check boxes, and the like. Essentially, it could not be used to interact with a remote session to our workplace. I knew the minute I read about your “Screen Image Recognition” and “Screen Scraping” that your program was going to solve that problem! And it has! It’s working perfectly and she, and I, are very pleased!

    Again, we owe you so much!

    Brother John
    Lansdowne, Pennsylvania USA

  2. Marcus Tettmar says:

    Thanks John for the great feedback. It’s wonderful to hear how our software can help to improve the quality of peoples’ lives. It makes doing what we do seem so much more worthwhile, and I’m very pleased that we’ve been able to make a difference. All the very best to you both.

Leave a Reply