File Timestamp Monitor


  1. Posts : 110
    Windows 10 Pro 64
       #1

    File Timestamp Monitor


    I want to monitor a text file and when its timestamp changes play a sound. I first though of doing this with Task Scheduler, but I don't see a way to directly monitor a file timestamp with Task Scheduler. I do see that this can be done with PowerShell, although I am uncertain if I can just start a PowerShell script and have it run all time time or if it's something that needs to be managed with Task Scheduler. The other option I'm looking at is Autohotkey, which would be helpful since I might want to actually look in the file to see what the event was that case the timestamp to change.

    Just asking for general feedback on the best way to do this, or if there might be something else.

    Win 10 Home (17763)
      My Computer


  2. Posts : 30,599
    Windows 10 (Pro and Insider Pro)
       #2

    I usually check with Nirsoft for such utilities. He offers several folder monitors, no one plays sound, as I can see.

    Nodesoft Folder Monitor 1.2.0.0 can monitor a folder (guess files too with filter) and play sound on change. Freeware, and clean as Virustotal says
      My Computers


  3. Posts : 110
    Windows 10 Pro 64
    Thread Starter
       #3

    Autohotkey solution


    This does what I wanted.
    Code:
    #singleinstance force
    #persistent
    filepath= C:\FileToMonitor.txt
    
    settimer, check_date, 60000 ; every minute
    
    check_date:
    
    FileGetTime, current_modified , %filepath%, M
    if (prev_modified = current_modified)
    {
    return
    }
    SoundPlay C:\Windows\Media\Ring01.wav
    
    prev_modified = %current_modified%
    return
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:34.
Find Us




Windows 10 Forums