Jump to content

Ensuring closed files?


Recommended Posts

Greetings,

Is there a way to write a script that will ensure a file is closed that may have been opened/accessed in another program running previous to the AutoIT script? I have an AutoIT script that runs after an instance of Streamreader running in another program...sometimes a file that is used in my AutoIT script is "left open" by the other program/Streamreader and it messes up the AutoIT script because the file cannot be accessed as it is left open...how can I avoid this? Thanks in advance for any advice.

Link to comment
Share on other sites

Greetings,

Is there a way to write a script that will ensure a file is closed that may have been opened/accessed in another program running previous to the AutoIT script? I have an AutoIT script that runs after an instance of Streamreader running in another program...sometimes a file that is used in my AutoIT script is "left open" by the other program/Streamreader and it messes up the AutoIT script because the file cannot be accessed as it is left open...how can I avoid this? Thanks in advance for any advice.

Usually Windows will take care of closing opened files when a program finishes (gracefully). Are you opening your files in read, or read/write mode? Is anything else (such as your anti-virus software) opening the files too?

Sample code??

Link to comment
Share on other sites

umm try this

While 1
        If ProcessExists("Put Process Name Here") Then
            MsgBox(0, "ProcessCheck", "The Process Still Exists")
        Else
            MsgBox(0, "ProcessCheck", "The Process Does Not Exist")
            Exit
        EndIf
    WEnd
Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

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