8.3 formatted files
Posted: Mon Mar 26, 2012 8:49 pm
				
				Hello, I have files being dropped into a hot folder to be moved to an organized folder structure. Hundreds of files are being dropped here each day. In the past this was being done with Applescript on an Apple Server, but this past weekend the workflow was moved to a Windows 2k8 server. The below code works flawlessly until a file is dropped in that is 8 characters + . + extension. As an example, if I were to drop two files
PAB1231201.pdf
PAB12312.pdf
into the folder, the app will crash. If I drop the first file in alone, it will perform as expected. If I drop the second file in alone, the app will crash. I see nothing in the code that would cause such a difference. We use many combinations of characters in our job structure and in every case where a file uses the 8.3 naming, the error happens.
Thanks for any help
Robert Short
			PAB1231201.pdf
PAB12312.pdf
into the folder, the app will crash. If I drop the first file in alone, it will perform as expected. If I drop the second file in alone, the app will crash. I see nothing in the code that would cause such a difference. We use many combinations of characters in our job structure and in every case where a file uses the 8.3 naming, the error happens.
Thanks for any help
Robert Short
Code: Select all
on putAwayProofs
   
   -- Establish a path where the new documents are stored and where they will be moved to.
   --Live Paths
   if the platform is "MacOS" then
      put "/Volumes/ART/PDFs/PROOF" into fixedDropPathP
      put "/Volumes/PROOFs/Proofs201" into fixedDestination
   else if the platform is "Win32" then
      put "E:/ART/PDFs/PROOF" into fixedDropPathP
      put "E:/PROOFs/Proofs201" into fixedDestination
   end if
   put "/" into pathDelim
   
   -- Get a list of the new files.
   set the defaultFolder to fixedDropPathP
   put the detailed files into tFileListP
   
   --Establish base time value for modification test
   put the date && the time into newTimeSeconds
   convert newTimeSeconds to seconds
   
   -- Process the file list
   repeat with x = 1 to number of lines of tFileListP
      
      // get modification date of file set elapsed time since modification 
      put item 5 of line x of tFileList into oldTimeSeconds
      put newTimeSeconds - oldTimeSeconds into elapsedSeconds
      
      if char 1 of item 1 of line x of tFileListP is among the items of "A,P,T" then
         put "OK" into theProduct
      else
         put "ERROR" into theProduct
      end if
      
      if theProduct is not "ERROR" and elapsedSeconds > 90 then
         
         //Build Folder Structure if it does not exist
         put item 1 of line x of tFileListP into dealNumber
         put fixedDestination & char 8 of dealNumber & pathDelim & char 1 to 3 of dealNumber into variableDestination
         if there is not a folder variableDestination then create folder variableDestination
         put variableDestination & pathDelim & char 1 to 8 of dealNumber into variableDestination
         if there is not a folder variableDestination then create folder variableDestination
         
         //Copy and rename the Proof PDF
         set defaultFolder to variableDestination
         put variableDestination & pathDelim & dealNumber into variableDestinationFile
         if there is a file variableDestinationFile then delete file variableDestinationFile
         revCopyFile fixedDropPathP & pathDelim & dealNumber, variableDestination
         delete file fixedDropPathP & pathDelim & dealNumber
         put CR & dealNumber & "  -  Proof Updated in Customer Proofs folder." before field "Data" 
      end if
      
   end repeat
   
end putAwayProofs