Jump to content

$FileGetSize doesn't refresh the file size


epo
 Share

Recommended Posts

Hi

Below is the code 

WinMinimizeAll()
Local $aaa = FileGetSize ( "D:\Datacap\Taskmaster_logs\tms.log" )
MsgBox($MB_SYSTEMMODAL, "", ByteSuffix($aaa))

Func ByteSuffix($iBytes)
    Local $iIndex = 0, $aArray = [' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB']
    While $iBytes > 1023
        $iIndex += 1
        $iBytes /= 1024
    WEnd
    Return Round($iBytes) & $aArray[$iIndex]
EndFunc   ;==>ByteSuffix

Not sure script prob or autoit prob...

Scenario is like this :-

a)  Open windows explorer & browse to D:\Datacap\Taskmaster_logs

b)  Check tms.log size (ie : 100mb)

c)  Minimize windows explorer

d)  Run above script & msgbox shows 100mb

e)  Let the taskmaster appl run for few days to increase the log

f)  Run above script again after few days & msgbox still shows 100mb

g)  Maximize windows explorer then in a blink, suddenly log size increase to 200mb

h)  Minimize windows explorer

i)  Run above script & msgbox shows 200mb

Questions :-

1)  To get the currect log size via $filegetsize, windows explorer need to be refreshed or closed ?

2)  Any additional script to add to refresh the log size in $filegetsize ?

Thx in advance...

Link to comment
Share on other sites

You could try sending an F5 (refresh) before doing your Size query.

It would seem your system (Explorer, etc) has gone to sleep, so until it is refreshed you may only get what is in memory.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

You could try sending an F5 (refresh) before doing your Size query.

It would seem your system (Explorer, etc) has gone to sleep, so until it is refreshed you may only get what is in memory.

U mean open windows explorer & send F5 & minimize it back ?

Link to comment
Share on other sites

Whatever works.

If Explorer is minimized, as you seem to have indicated, then you may need to Restore it first or make it active ... that might be enough or you may need to use F5 as well. Or you could simply close and re-open Explorer at that location.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Is this on a Laptop?

Regardless, I imagine it is a Windows issue as JohnOne said, probably tied into power saving or somesuch.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I'd look for a setting in Taskmaster for logging, see if anything stands out.

Checked aldy & nothing wrong with it...

Is this on a Laptop?

Regardless, I imagine it is a Windows issue as JohnOne said, probably tied into power saving or somesuch.

Nope... It's physical server running on Win 2008...

Link to comment
Share on other sites

If it only happens when you have Explorer open to that folder then why do you have it open?

Have you tried running FileGetSize() multiple times? (just a guess)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...