Jump to content

Search for updates in windows folder and open recently updated file


coronatuss
 Share

Recommended Posts

Hello,
I'm new to Autoit Forum and I'm a little lost. I would like to know if it is possible to design a Script capable of observing and detecting updates within a specific folder or directory of windows, both new files and old updated files. Once the file is detected, it should be opened on the desktop.

Many thanks!

Link to comment
Share on other sites

Hello,
I'm new to Autoit Forum and I'm a little lost. I would like to know if it is possible to design a Script capable of observing and detecting updates within a specific folder or directory of windows, both new files and old updated files. Once the file is detected, it should be opened on the desktop.

Many thanks!

Link to comment
Share on other sites

  • Moderators

@coronatuss two posts, and both in the wrong forum. Please pay attention to where you post, and stick to a single thread: spamming the forum will not get you help any faster.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

In .Net there is a FileSystemWatcher object that we use for this. If I remember correctly, however, it can't be used in AutoIt, so you might consider a .Net language. That being said... it would be cool to make an AutoIt wrapper for it, but I'm not sure if it would be possible/feasible.

As for doing this in pure AutoIt, I can't think of a great way to detect updates to files... maybe you can use something like this...

Local $asOldFileList
Local $asNewFileList

; Get the list of files in the directory
$asOldFileList = _FileListToArray($yourPath)

While True
    
    ; Wait a bit, you probs don't need these to open instantly
    Sleep(500)
    
    ; Get the current list of Files
    $asNewFileList = _FileListToArray($yourPath)
    
    ; Check that the arrays match and open all differences
    ;~ <Some code>
    
    ; Keep the current list as the old one
    $asOldFileList = $asNewFileList
    
    If $someExitCondition Then ExitLoop
WEnd

(This code isn't tested, doesn't work, and is intended as a framework of sorts :))

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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