Jump to content

How to detect modified file before it saved?


Recommended Posts

For instance

1) A file opened

2) Some text inserted into the file but without saving the file.

Is there a way to detect the status of the file?.

That doesn't actually make sense. If you FileOpen() for write, and then FileWrite() anything, it is already saved.

You probably mean you did FileRead() (or maybe _FileReadToArray()), changed data in memory, and want to track changes. That would be handled by a flag variable like:

Global $fDataChanged
Where you read the data into memory, add "$fDataChanged = False", and anywhere in your script where you change any of the data, add "$fDataChanged = True". When it is time to decide if it needs to be saved, it would just be:
If $fDataChanged Then

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

That doesn't actually make sense. If you FileOpen() for write, and then FileWrite() anything, it is already saved.

You probably mean you did FileRead() (or maybe _FileReadToArray()), changed data in memory, and want to track changes. That would be handled by a flag variable like:

Global $fDataChanged
Where you read the data into memory, add "$fDataChanged = False", and anywhere in your script where you change any of the data, add "$fDataChanged = True". When it is time to decide if it needs to be saved, it would just be:
If $fDataChanged Then

:)

I think you missed my point.

I am actually openning excel file, and typing some text into a cell.

At this point I want to know that the file modified with no save.

I want to know that status since my application is crashing inside the excel UDF file.

here is a link to my example with reproduction steps.

Be Green Now or Never (BGNN)!

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...