FileCopy/FileMove locking folder?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
momo2000
Posts: 32
Joined: 25 Jan 2015, 12:00

FileCopy/FileMove locking folder?

03 Apr 2017, 19:11

I have a photo system in which files come to a “watch folder” and then the photo system displays them. Works fine. But then I wrote a AKH script to copy the files from that watch folder and archive them. The script is below, and works fine. HOWEVER, after I run the script the photo system software will not load any new photos (that subsequently get placed there) from the watch folder. It is almost as if the act of running this script puts some type of “lock” on the folder. I can reproduce this consistently. New files get copied there just fine, but the photo system can’t retrieve them after the script has run. I must restart the computer to get things working again (and release the lock on the folder). Has anyone ever seen anything like this before? Is there another command I could issue at the end of my script to “release” the folder?

Code: Select all

 
#SingleInstance

global SourceFolder
global CopyToFolder1
global CopyToFolder2
global MoveToFolder1
global TimeFormatStr
global AgeOfFilesToExclude

SourceFolder=\\Photoboothpc\eye-fi-card-in			                    ; Source of files
CopyToFolder1=C:\Users\UEG\Dropbox\UEG-Social\Photos-INN				; Copy to Dropbox
CopyToFolder2=C:\Users\UEG\OneDrive\PhotoSystem\LobbyPhotos-IN			; copy for lobby photos
MoveToFolder1=C:\Users\UEG\OneDrive\PhotoSystem\Photos-ARCHIVE			; MOVE (copy & delete) to archive folder

TimeFormatStr := "yyyy-MM-dd_HH'H'-mm'M'-ss'S'"   					; set the format of time time
AgeOfFilesToExclude = -10											; curently minutes, but could be change to hours/days/etc
;*******************END CONFIGURATION SECTION*******************
runcopyscript()
;*******************Function below
runcopyscript()
{
   TimeNow = %A_Now%													; gets system time
   TimeNow += %AgeOfFilesToExclude%, Minutes 							; curently minutes, but could be change to hours/days/etc
   Loop %SourceFolder%\*.* 											; Loop the folder for all files (or change *.* so something else)
   { 
      If (A_LoopFileTimeModified < TimeNow) 
      { 
         OriginalFileName = %A_LoopFileLongPath%    					; get full name-path of file
         FileGetTime, NewFileName, %OriginalFileName%, M    			; get time stamp of file, "M" is "last modified" time
         FormatTime, TimeStr, %NewFileName%, %TimeFormatStr%  			; format the time string
         FileExtension = %A_LoopFileExt%   							; get the file extension of the file
         StringLower, FileExtension, FileExtension						; convert file extension to lower case, in case it is not.
         NewFileName = %TimeStr%.%FileExtension%    					; build the name of the NEW file
         FileCopy, %OriginalFileName%, %CopyToFolder1%\%NewFileName%	; Copy to location ONE and give new name.
         FileCopy, %OriginalFileName%, %CopyToFolder2%\%NewFileName%   ; Copy to location TWO and give new name.
         FileMove, %OriginalFileName%, %MoveToFolder1%\%NewFileName%   ; MOVE to location THREE and give new name.  Deletes files in original location.
      } 
   } 
}
momo2000
Posts: 32
Joined: 25 Jan 2015, 12:00

Re: FileCopy/FileMove locking folder?

13 Jul 2017, 12:59

Took 7 months, but I finally solved this one, so thought I should clean up my incorrect assumptions in my post. The problem was NOT AHK. It was the Photobooth software. Just wanted to update in case anyone ever thinks they have a similar problem and suspect it is AHK, I don't want them to think that AHK was the problem . . . because as it turns out, it was not.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: cjsmile999 and 356 guests