Jump to content

Comparing file sizes

Recommended Posts

My code:

$file = "data.txt";
Run("php test.php", "", @SW_HIDE);
$filesize = FileGetSize($file);
while 1
    if $filesize < FileGetSize($file) Then
        $filesize = FileGetSize($file)
        msgbox(0,"size changed", "it changed...")
    func OnAutoItExit()
        Run(@ComSpec & " /c taskkill /IM php.exe /F", "", @SW_HIDE)

basically the while loop doesn't work. Is it because my php script is ran in a never ending while, and it is waiting for it to be done, or what?

I'd appreciate some help with this, and im just messing around with this out of complete boredom. Also, do I have to have the opt there since OnAutoItExit is the default?

Link to comment
Share on other sites

I don't think your php file is "run" at all, try ShellExecute() instead :)

Yes it is, because i have new data in the file every 5 seconds, the while just isn't catching the new filesize. It works fine, i just need it to catch the new file size.

function writefile($file,$source)
        $write = @fopen("$file", 'a+');
        @fwrite($write, $source);
        writefile("data.txt", time() . "\n");

Nevermind, it was because of permissions on the file. My bad, appreciate it. Stupid me >.>

Edited by axilant
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

  • Recently Browsing   0 members

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