stevecasper Posted October 15, 2009 Report Share Posted October 15, 2009 I'm tweaking a macro with a very basic If/Else sequence in order to improve, if only slightly, a macro I currently run about 5 times each day. If you want details about why I want to know this, please read below; otherwise, the question is simple: Does Macro Express have a command to extract the size of a file directly? I can't seem to find one. If so, what is it? If not, does anybody have an easy work-around? ____________________________________ Situation: I have to run this macro against 5 different .txt files which range in size from just a few KBs to several hundred MBs. Generally, they look like this: A.txt = 14 MB B.txt = 5 MB C.txt = 60 MB D.txt = 250 MB E.txt = 58 KB The .txt files are set to variable %T10% via a prompt to the user to browse to and select the file. A and B usually take between 10-30 seconds to process, C and D take between 2-6 minutes, and E is pretty close to instantaneous. Because some of these processes take a while, I have a set of Dialog Boxes that update at each increment of 10% progress. This is fine for the slow ones, but it slows down the really fast ones. Currently, I have an ugly "If Variable %T10% contains E.txt / Then Skip the Dialog Box" (it's actually an If contains E.txt OR If contains E2.txt... and it could get longer as I tweak it). I would like to have a simpler statement along the lines of "If File %T10% < 1MB / Then Skip the Dialog" Or something similar. I'm sure it would include Integer Variables. If I could just find some easy way of collecting that file size. This would be built against a future where the sizes of these files could fluctuate. The E.txt file may be the small one now; but in the future, it could be large, too, and the updates would be beneficial. Likewise, A and B files are occasionally much smaller, and wouldn't need the updates to be displayed. Maybe the answer is obvious and I'm just not seeing it. Any help would be appreciated. Thank you! Quote Link to comment Share on other sites More sharing options...
stan Posted October 15, 2009 Report Share Posted October 15, 2009 Hi Steve, The Variable Set Integer command has a Set Value from the Size of a File function. It sounds like this is what you are looking for. Quote Link to comment Share on other sites More sharing options...
stevecasper Posted October 15, 2009 Author Report Share Posted October 15, 2009 Ahhhhh FANTASTIC!!!!! Thanks, Stan! I knew it was going to be something simple and easy. I was just looking in the wrong place (Files/Folders, rather than the just-as-obvious Variable Set Integer)!!! 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.