Sign in to follow this  
Followers 0
huldu

Why wont my FileWrite work?

7 posts in this topic

Hi

Im having problems with FileWrite to work in my script, sometimes i get it to work one time, then it stops work. Its so random, just no idea whats wrong.

The idea behind this script (will be GUI when im done), is to check if your connection is working. Everytime connection drops, it will log the time when it dropped, and log the time when the connection was resumed again.

The script works fairly well atm, just that the FileWrite isnt working too well.

Hope someone can help me clear this mess out ;)

test3.au3


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites



Hi

Im having problems with FileWrite to work in my script, sometimes i get it to work one time, then it stops work. Its so random, just no idea whats wrong.

The idea behind this script (will be GUI when im done), is to check if your connection is working. Everytime connection drops, it will log the time when it dropped, and log the time when the connection was resumed again.

The script works fairly well atm, just that the FileWrite isnt working too well.

Hope someone can help me clear this mess out ;)

shouldn't this:

$file = FileOpen(@scriptdir & "log.txt", 1)

be

$file = FileOpen(@scriptdir & "\log.txt", 1)

?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

shouldn't this:

$file = FileOpen(@scriptdir & "log.txt", 1)

be

$file = FileOpen(@scriptdir & "\log.txt", 1)

?

I tried using the \ but had the same result, so i never did anything about it. Again i added the \ but its the same thing, just wont work.


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

I tried using the \ but had the same result, so i never did anything about it. Again i added the \ but its the same thing, just wont work.

can you be more explicit on what doesn't work ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Just did some more testing and this is what i found out sofar.

The info ONLY writes to log when i exit the script!. Why is it this way? it wont save anything during the run of the script!


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Just did some more testing and this is what i found out sofar.

The info ONLY writes to log when i exit the script!. Why is it this way? it wont save anything during the run of the script!

ok... you don't close the file after writing so you cannot use the file till you do so,...

Just skip the fileopen and change the filewrite to use the filename ...

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

ok... you don't close the file after writing so you cannot use the file till you do so,...

Just skip the fileopen and change the filewrite to use the filename ...

Thanks!

I changed the FileWrite thing to FileWrite(@scriptdir & "\log.txt") and now it writes to file in realtime.


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0