MakaPakaTobyHannah Posted February 28, 2020 Report Share Posted February 28, 2020 This particular issue has plagued me for a very long time, and I just cannot figure out what the issue is. I find that "Window Activate" is extremely unreliable. Whenever I develop scripts where, after one thing is done in one window another window must be activated before the macro proceeds, the macro simply hangs. Today’s example. I wish to batch print to PDF all *.musx files in a given directory. For this to work, each *.musx files must first be opened, in turn. I have to: 1) Issue the open command to the first file in the list 2) Wait for the file to open 3) Issue a "print" command within the application (this will call Adobe Acrobat) 4) Wait for the PDF to have been compiled and open within Acrobat 5) Close the newly opened PDF 6) Reactivate the window of the original application 7) Close the file that was opened within that application 8) Continue on to the next file by looping back to step (1) There are various dialog boxes that come up (Open, Print, Save PDF File As). In order for the "open" and "close" commands (sent as keystrokes) within the main application to function properly, the main application must be active. Hence my use of the Window Activate command. I have experimented with "Exact Match," "Partial Match," "Partial Match" with "The name contains wildcards" checked and the use of the asterisk character. I have inserted delays in front and after the Window Activate commands. Sometimes it works, sometimes the macro hangs. Is this a known problem? Again, I have had trouble with this for so long, it’s not even funny. But today, I just cannot get this process to work reliably. I have hundreds of PDFs to compile, and I don’t want to do this manually one file at a time. MORE INFO I just inserted an "If Window is Running" check. I placed the window title precisely; instead of typing it, I populated the field by selecting the window title via "Browse". The "If Window is Running" check is supposed to open a text box saying, the window is running. But that text box doesn’t even come up. In other words, the If function doesn’t see the window, even though it is visible. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.