I want to monitor a folder for new png files and then popup a gui for data entry. I just cobbled this together with stuff from the forum to test, but the script keeps looping while the GUI is onscreen and then it complains about duplicate declarations.
Edit: This works but it feels like a fudge. Edit 2: and if it is a very large file it may not finish copying before the loop begins again...
Code: Select all
pngPath := "E:\1newImage\*.png"
tempPath := "E:\2tempImage"
renamedImagePath := "E:\3renamedImage\"
SetTimer, FolderMon, 10000
return
FolderMon:
Loop, %pngPath%
{
FileCopy % pngPath, %tempPath%
Sleep 100
FileRecycle % pngPath
Sleep 100
goto GuiCreate
}
return
GuiCreate:
Gui Add, Edit, vTitle
Gui Add, Button, gSubmit, Submit
Gui Show
return
Submit:
Gui Submit
Gui Destroy
newFileName := Title ".png"
Sleep 100
tempFileFullPath := "E:\2tempImage\*.png"
newFileFullPath := renamedImagePath newFileName
msgbox % tempFileFullPath " " newFileFullPath
FileCopy % tempFileFullPath, %newFileFullPath%
Sleep 100
Msgbox % "new file name" newFileName