axilant Posted May 25, 2008 Posted May 25, 2008 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...") EndIf sleep(500); WEnd Opt("OnExitFunc","OnAutoItExit"); func OnAutoItExit() Run(@ComSpec & " /c taskkill /IM php.exe /F", "", @SW_HIDE) EndFunc 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?
monoceres Posted May 25, 2008 Posted May 25, 2008 I don't think your php file is "run" at all, try ShellExecute() instead Broken link? PM me and I'll send you the file!
axilant Posted May 25, 2008 Author Posted May 25, 2008 (edited) monoceres said: 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. <?PHP function writefile($file,$source) { $write = @fopen("$file", 'a+'); @fwrite($write, $source); @fclose($write); return(true); } while(true) { sleep(5); writefile("data.txt", time() . "\n"); } ?> Nevermind, it was because of permissions on the file. My bad, appreciate it. Stupid me >.> Edited May 25, 2008 by axilant
monoceres Posted May 25, 2008 Posted May 25, 2008 Try changing this: if $filesize < FileGetSize($file) Then Toif $filesize <> FileGetSize($file) Then Broken link? PM me and I'll send you the file!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now