1
Post New Requests Here / Re: script to download files based on dates in folders and filenames
« on: March 30, 2016, 05:47 PM »
Hi all I found a solution to this from the autohotkey forums. Code posted here for posterity...
gui, add, DateTime, vmydate altsubmit
Gui, add, Button, gGo ym, Go
Gui, Show
return
Go:
Gui, Submit
; removed useless stuff here
SetWorkingDir, %A_Desktop%\comics
BlockInput On ;disables keyboard or mouse use when script is running
; SALLY FORTH
MyURLpass :="user:pass"
; removed useless stuff here
MyURL := "http://bbs.rbma.com/repo/Sally_Forth/" ; we'll add year and month in the loop
; removed useless line here
loop, 7 { ; switched to loop, while is unnecessary and wouldn't work anyway without changing value of n
FormatTime, mydate, %mydate%, yyyyMMdd ; fixes formatting from EnvAdd, which adds a timestamp
MyFile= SFT%mydate%.tif
FormatTime, year, %mydate%, yyyy
FormatTime, month, %mydate%, MM
RunWait % "curl.exe -o " MyFile " -u " MyURLpass " " MyURL year "/" month "/" MyFile ; -v more talkitive
EnvAdd, mydate, 1, Days ; increases day by one
}
Gui, add, Button, gGo ym, Go
Gui, Show
return
Go:
Gui, Submit
; removed useless stuff here
SetWorkingDir, %A_Desktop%\comics
BlockInput On ;disables keyboard or mouse use when script is running
; SALLY FORTH
MyURLpass :="user:pass"
; removed useless stuff here
MyURL := "http://bbs.rbma.com/repo/Sally_Forth/" ; we'll add year and month in the loop
; removed useless line here
loop, 7 { ; switched to loop, while is unnecessary and wouldn't work anyway without changing value of n
FormatTime, mydate, %mydate%, yyyyMMdd ; fixes formatting from EnvAdd, which adds a timestamp
MyFile= SFT%mydate%.tif
FormatTime, year, %mydate%, yyyy
FormatTime, month, %mydate%, MM
RunWait % "curl.exe -o " MyFile " -u " MyURLpass " " MyURL year "/" month "/" MyFile ; -v more talkitive
EnvAdd, mydate, 1, Days ; increases day by one
}