Jump to content
Macro Express Forums

Get File Size


Recommended Posts

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!

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.

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.

  • Create New...