minmi Posted July 11, 2007 Report Share Posted July 11, 2007 Hi all, Just been using Macro Express to automate some batch processing of files, and have a question for those more knowledgeable than me: My Macro sifts through a folder-load of scripts for a CAD program. Each script plots the required points in the CAD program, then saves out a finished ".dwg" file to another folder. But I'm having trouble implementing a "smart" way to get MacroExpress to wait for the CAD program before looping back through the folder. I tried using "Wait File Exist", but so far as I can see, you have to specify the precise filename if you're going to use that command. In other words, you can only make it look for a specific file, not one that varies on each pass through the loop. So I think I need a way of specifying the file as a mix of text and string (the string being the same as the name of the original script that's running for this particular pass throught the loop). Is there a way to do this? At the moment, I've fallen back on just sticking a big "wait time delay" into the macro to make sure the CAD program's had time to do it's thing, but that's neither elegant nor time-efficient, and I can only get away with it because at the moment the individual CAD scripts are small and complete in under a minute. I've got another batch to do fairly soon that will take varying periods of time, and I've no way of second-guessing how long each one might take, so this method won't work unless I allow a stupidly long time delay. Any bright ideas gratefully accepted! Cheers, Minmi Quote Link to comment Share on other sites More sharing options...
kevin Posted July 11, 2007 Report Share Posted July 11, 2007 Anyplace you can enter something specific, such as a filename, in a macro command, you can also put a variable. So simply set a variable to the filename you want to wait for into something like %T1% and enter %T1% in the Wait for File Exist. The Wait for File Exist will continue the macro as soon as the file exists. Your CAD program may not be finished writing to the file. You should follow the Wait for File Exist command with a Wait for File Ready command like this: Wait for File Exist: "%T1%" Wait for File Ready: "%T1%" Quote Link to comment Share on other sites More sharing options...
minmi Posted July 11, 2007 Author Report Share Posted July 11, 2007 Ah, so I do it in the direct editor... I'm afraid I didn't investigate that! Thanks for the advice - especially regarding the "Wait File Ready" command... Quote Link to comment Share on other sites More sharing options...
kevin Posted July 12, 2007 Report Share Posted July 12, 2007 Ah, so I do it in the direct editorWhile you could do it in the Direct Editor you can also do it in the Script Editor. In the Script Editor click on the Wait for File Exist command. When the dialog comes up put the variable in the 'Filename:' field. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.