Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
DavJans
- Posts: 275
- Joined: Thu Dec 12, 2013 4:21 pm
Post
by DavJans » Wed Sep 29, 2021 9:37 pm
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
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
-
Bill
- Posts: 57
- Joined: Sat Apr 08, 2006 8:22 pm
Post
by Bill » Thu Sep 30, 2021 6:58 am
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?