Author Topic: MODEMACRO - file size in KB  (Read 724 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 78
MODEMACRO - file size in KB
« on: May 18, 2023, 11:29:56 AM »
I have a MODEMACRO code to display date on statusbar.
Code: [Select]
(setvar 'modemacro "The date is: $(edtime,$(getvar,date),DD.MO.YYYY)")
Can anyone help me, please, to change the code to display the current file size in KB?

Like "The file size is ... KB"

Thank you

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: MODEMACRO - file size in KB
« Reply #1 on: May 18, 2023, 12:06:24 PM »
I don't think this is possible, as the filesize does not appear as a system variable which may be referenced through DIESEL. You would perhaps need to use LISP to set one of the USERI system variables on drawing startup/save, and then read this system variable from a DIESEL expression embedded in your MODEMACRO system variable.

You can of course alternatively reference the filesize using a field expression (%<\AcVar filesize \f "%ld%by1">%).

BIGAL

  • Swamp Rat
  • Posts: 1414
  • 40 + years of using Autocad
Re: MODEMACRO - file size in KB
« Reply #2 on: May 18, 2023, 09:12:03 PM »
Not tested

Code: [Select]
(setvar 'modemacro (strcat "File size is " (rtos (vl-file-size (strcat (getvar 'dwgprefix)(getvar 'dwgname))) 2 0) " Kb"))
A man who never made a mistake never made anything

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: MODEMACRO - file size in KB
« Reply #3 on: May 19, 2023, 03:51:12 AM »
Not tested

Code: [Select]
(setvar 'modemacro (strcat "File size is " (rtos (vl-file-size (strcat (getvar 'dwgprefix)(getvar 'dwgname))) 2 0) " Kb"))

Whilst that will work to set the initial value, the resulting file size won't be updated automatically.

d2010

  • Bull Frog
  • Posts: 326
Re: MODEMACRO - file size in KB
« Reply #4 on: May 19, 2023, 05:01:57 AM »
 :mrgreen:
Not tested

Code: [Select]
(setvar 'modemacro (strcat "File size is " (rtos (vl-file-size (strcat (getvar 'dwgprefix)(getvar 'dwgname))) 2 0) " Kb"))
Whilst that will work to set the initial value, the resulting file size won't be updated automatically.

You need refreshing -disk;
You can display  the filesize of  any file, only after disk-refreshing
Step1) You check status of .BAK
Step2) If  the .BAK is updated then you display the filesize of DWG.
Please you can test with the extension  .BAK not .Dwg?
 :glaresad:
« Last Edit: May 19, 2023, 05:06:57 AM by d2010 »