Page 2 of 2
Re: Delete contents of Sub-folder after Time Frame ?
Posted: 28 Nov 2013 05:30
by CookieMonster
Enternal wrote:Yeah it's not possible to completely run the script with just XYplorer like many have said. Autohotkey is a great idea to rerun the script over a certain time period. Here's an example:
Code: Select all
#Persistent
InputBox, TimeMinutes, Minutes, How Many Minutes to Rerun?, , 250, 100
If TimeMinutes Is Not Number
{
MsgBox, Invalid Value for Minutes. Cannot Continue.
ExitApp
}
TimeMilli := TimeMinutes*60*1000
SetTimer, RunApp, %TimeMilli%
Return
RunApp:
;FormatTime, TimeString, , Time
;MsgBox, The Current Time is %TimeString%
Run, Application.exe
Return
There isn't a directory in that script that should be entered that is to be deleted after XX days/weeks in the script, or must I squeeze it in ? This script from the looks of it, is only running a program after a Time Frame ?
Re: Delete contents of Sub-folder after Time Frame ?
Posted: 28 Nov 2013 08:10
by binocular222
I hate GUI, so, the AHK script would look like this:
Code: Select all
;#notrayicon ;uncomment this line if you hate tray icon
#Persistent
SetTimer, RunApp, 3600000 ;3600000ms = 1 hour
Return
RunApp:
Loop, %A_AppData%\Microsoft\Office\Recent\*.* ;Place any folder path here
FileDelete, %A_LoopFileFullPath%
Re: Delete contents of Sub-folder after Time Frame ?
Posted: 28 Nov 2013 13:03
by CookieMonster
It looks like to me this script as well, is only running a program then deleting the files for that program, am I missing something ?
Re: Delete contents of Sub-folder after Time Frame ?
Posted: 28 Nov 2013 13:21
by highend
Interesting. I don't see any app at all. Maybe you should try to look into a documentation? Loop, <folder> is a loop over file(s) / folder. What's missing in any of these scripts? Timeframes.
This is not a general discussion board about AHK or other scripting languages (they have their own)...
Re: Delete contents of Sub-folder after Time Frame ?
Posted: 28 Nov 2013 15:04
by binocular222
The script in my post does not run any app at all.
It delete all files in %AppData%\Microsoft\Office\Recent\
every 1hr.
@Cookie: For simple script like this, you can refer to AHK help file.