Jump to content
Macro Express Forums

Waiting For A String-specified File?


minmi
 Share

Recommended Posts

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

Link to comment
Share on other sites

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%"

Link to comment
Share on other sites

Ah, so I do it in the direct editor
While 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.
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...