Run a script as soon as the Last Modified date changes

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
thegame2010
Posts: 29
Joined: 04 Feb 2016, 18:14
Location: 'Murica

Run a script as soon as the Last Modified date changes

Post by thegame2010 » 26 Feb 2016, 12:03

Is there a way to check a file's modify date and to execute a command as soon as it changes?

Basically we have a powerpoint presentation that is stored on a computer and is always presenting. My code would probably look like this:

Code: Select all

Loop
{
	Check file date = VarA
	If VarA ≠ VarB
		run taskkill /IM pptview.exe ,, hide
		sleep 150
		run c:\users\username\desktop\filename.pptx
		Set VarA → VarB
	Else
		Set VarA → VarB
return
}
Note: of course this isn't in ahk language, but the idea is there. The way it's currently written, as soon as the script launches it will relaunch the file in an attempt to sync the variables. After that it just checks over and over.

I just need help on syntax. Every request I put in here gets me just a little better at this coding. It's very simple, but I'm still unfamiliar.
garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: Run a script as soon as the Last Modified date changes

Post by garry » 26 Feb 2016, 12:17

some commands
-FileGetTime, OutputVar, C:\My Documents\test.doc, M
-a_loopfiletimemodified
-settimer .....
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Run a script as soon as the Last Modified date changes

Post by Nextron » 26 Feb 2016, 13:07

You can also look into WatchFolder().
Post Reply

Return to “Ask for Help (v1)”