Page 1 of 1

A computer only does what you tell it to?

Posted: Wed Sep 29, 2021 9:37 pm
by DavJans
Somehow this is copying things that I don't ask it to. I'm wondering if I'm missing something or if it is just a glitch. Its happening on a windows 10 desktop but I cant reproduce the issue in the livecode development environment. 99% of the time it works normally but sometimes it copies the folder i'm copying files from with random folders and files within that. and those files and folders aren't even *.NC1 files. Any ideas?

Code: Select all

on getPartList
   send dbOpen to stack "MFC Tracking System"
   put "SELECT piece_mark from parts_cutlist WHERE lot = '" & tSL & "' AND  job = '" & tSJ & "' AND station = 'Plate Processor'" into tSQL
   put revDataFromQuery(comma, return, gConnectionID, tSQL) into tPartList
   send dbClose to stack "MFC Tracking System"
   put empty into tJobFolder
   set the defaultfolder to "C:\NC Files\"
   put the files into filestodelete
   repeat for each line tLine in filestodelete
      delete file tLine
   end repeat
   set the defaultfolder to "\\10.0.15.15\NC Files\"
   put the folders into joblist
   repeat for each line tLine in joblist
      if tLine contains tSJ then
         if tJobFolder is empty then
            put tLine into tJobFolder
         else
            put cr & tLine after tJobFolder
         end if
      end if
   end repeat
   repeat for each line ttLine in tJobFolder
      repeat for each line tLine in tPartList
         answer tLine
         revCopyFile "\\10.0.15.15\NC Files\" & ttLine & "\" & tLine & ".NC1","C:/NC Files/"
      end repeat
   end repeat
end getPartList

Re: A computer only does what you tell it to?

Posted: Thu Sep 30, 2021 6:58 am
by Bill
Where are you setting tSJ? it's filled in by the DataQuery?

Hard to say what's happening from the script alone, try outputting the results to some text then you can maybe better figure out what's going on.

Also maybe do:

Code: Select all

put "\\10.0.15.15\NC Files\" & ttLine & "\" & tLine & ".NC1" into tCopyTarget
revCopyFile  tCopyTarget,"C:/NC Files/"
Also how come you have backslashes and forward slashes?