Jump to content
Macro Express Forums

Recommended Posts

I have a little error trap:

 

If Window Title "Font Warning" is on top

Text Type <ENTER>

Delay 250 Milliseconds

End If

 

Simple. And it works just fine as I loop thru a big directory outputting one graphic image from each one-page file. However in *some* files, there is more than one page so the warning reappears for each page. There are usually two, maybe three, but there are no guarantees.

 

Is there anything like a do ... while command? I've been scratching my head for a while and have tried looking it up, but I haven't hit upon the search words that will locate it (if it exists). Repeat Until doesn't evaluate this kind of condition. Is there something obvious I'm missing?

 

Thanks,

 

Jeanne

Link to comment
Share on other sites

I don't really follow what you're trying to do. What sort of files are these that you're processing? What exactly is on each 'page' of them? A graphic filename? If they are text files then perhaps Text File Begin Process could be relevant. But by far the best way to proceed if you're serious about getting practical help would be to construct a simple example and upload it (or its code) so that we have something solid to work on.

 

Have you also looked at Repeat With Folder?

"This command scans through a folder and finds each file or subfolder in the folder. During the repeat process each successive file name or subfolder is placed in a text variable which can then be processed by other macro commands."

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

There's not a command like you are looking for and actually a do-while wouldn't work either because it's not a persistent condition. IE the condition keeps recurring over multiple instances. But I do have two ideas for you.

 

The first idea, and IMHO the most elegant, is to create a second macro to handle the error popup. I've done this trick a few times before and it works great. For one client certain patients would generate a DNA warning and it was really hard to handle because few patients caused it and it added a lot to the timing. So I created a second macro that was activated by the appearance of the window that did the same thing you are doing. Understand this operates simultaneously. Some are uncomfortable with the concept of running multiple macros at the same time but it works great in many cases. Make sure that you don't have the player lock enabled.

 

The next suggestion is to create a nested loop to handle the errors. Since you don't know how many there are you need an infinite loop. But MEP doesn't have such a thing so what I do is create a Repeat Until that compares a variable to itself with Does Not Equal. In there I would add a delay then an If Window is Running condition. If it is running hit Enter, Else Break. This would effectively do what you want.

 

Also I wouldn't use the Enter like you have. Instead I would use the Windows Control feature. The reason being is that you could use the OK button (Or whatever it's named that makes the box disappear) in your condition and also use the control for the mouse click. EG If Control is Enabled, Mouse Click on Control. This is especially handy for other reasons like it the window looses focus.

 

Finally I'd also look in your app for a configuration option to suppress those warning. Look online as well, it may be a hidden feature requiring a reg hack.

Link to comment
Share on other sites

I don't really follow what you're trying to do. What sort of files are these that you're processing? ,,,

Have you also looked at Repeat With Folder?

 

These are music notation files and the program can export an image file (TIFF or EPS) of the page. Yes, this little trap sits within a "Repeat With Folder" routine. The routine works just as expected and so does the error trap -- unless this warning pops up *and* the file has more than one page (resulting in two graphics files, one for each page, but also a warning for each page).

Link to comment
Share on other sites

What a lot of helpful info. Thank you, Cory.

 

The first idea, and IMHO the most elegant, is to create a second macro to handle the error popup. ... Some are uncomfortable with the concept of running multiple macros at the same time but it works great in many cases. Make sure that you don't have the player lock enabled.

 

So you use something like the "If Window Title "Font Warning" is on top" and if true, use "Macro Run"? I've already used "Macro Run" and would have expected that the parent waits for the child to complete. It does seem like the macro sometimes moves ahead to open the new file before it finishes with the current file and that surprised me. It worked, so I didn't worry about it. (Except it didn't work with two or more message boxes.) If these are running simultaneously, this is starting to make sense. I've tried adjusting the timing but the timing can be awfully hard to figure. (For a different process, I just had to put in a "Pause: Basic" and click Resume as needed.)

 

The next suggestion is to create a nested loop to handle the errors. Since you don't know how many there are you need an infinite loop. But MEP doesn't have such a thing so what I do is create a Repeat Until that compares a variable to itself with Does Not Equal. In there I would add a delay then an If Window is Running condition. If it is running hit Enter, Else Break. This would effectively do what you want.

 

Intriguing. I will try this just to see it work. I would never have conjured this up.

 

 

Also I wouldn't use the Enter like you have. Instead I would use the Windows Control feature. The reason being is that you could use the OK button (Or whatever it's named that makes the box disappear) in your condition and also use the control for the mouse click. EG If Control is Enabled, Mouse Click on Control. This is especially handy for other reasons like it the window looses focus.

 

Thanks for this too. I'm not so familiar with controls but want very much to understand it and you've given me a start. (Naturally, one starts with what one knows and works from there.) This button says DONE and, actually, <enter> <esc> and "D" are all unreliable. Maybe because two macros are running simultaneously? I will definitely try testing for a control (and in other circumstances "window running" rather than "window on top").

 

 

Finally I'd also look in your app for a configuration option to suppress those warning. Look online as well, it may be a hidden feature requiring a reg hack.

 

Interesting question.

 

Very sincere thanks,

 

Jeanne

Link to comment
Share on other sites

Regarding the second macro idea I don't think you're getting it. The macro for the warning suppression will not be referenced in the primary macro. It will be activated when the window title appears. IE it operates completely independently. Even when the primary macro is not running. Of course if you would like it to only fire when the primary macro is running you can en/disable it in the macro.

Link to comment
Share on other sites

Regarding the second macro idea I don't think you're getting it. The macro for the warning suppression will not be referenced in the primary macro. It will be activated when the window title appears. IE it operates completely independently. Even when the primary macro is not running. Of course if you would like it to only fire when the primary macro is running you can en/disable it in the macro.

 

Okay, thanks for that. Honest, it really did look like parent and child were running simultaneously. I will continue to watch that one and figure it out. But I'm still not intimidated. I will try running "yours" and mine together. Then when I see it working flawlessly (!), presumably, both could be children of a macro that does nothing other than running both.

 

Sincerest thanks,

 

Jeanne

Link to comment
Share on other sites

Also I wouldn't use the Enter like you have. Instead I would use the Windows Control feature. The reason being is that you could use the OK button (Or whatever it's named that makes the box disappear) in your condition and also use the control for the mouse click. EG If Control is Enabled, Mouse Click on Control. This is especially handy for other reasons like it the window looses focus.

 

But that control has to be active when the macro starts? This is not a big deal; I think I can work with the window title and it will be good enough. (This is just for myself, not a client.) I did actually make this work when the control was active (just to test it) so I still appreciate the input. Well worth knowing about.

 

Thanks,

Jeanne

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...