PreDr.ag
03-21-2007, 11:48 AM
I have two (I think interesting) questions:
First - how to write script that search a file and if that file isnt on that partition search another etc.Also I need to copy a file from application to that one.And last I need dialog message to notify user that file is or isnt found
and when file is copied.
Because I don know almost anything about writing script dont laugh at my
attempt to write this one
*problem is that first dialog shows and then second dialog show that file was copied but it isnt*
Dialog.Message ("Please wait","File is being copying")
result = File.Find("C:\\", "file.something", true, nil);
if (result) then
strnew = Table.Concat(result, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something", strnew, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else -- if file isnt found search another partition
result1 = File.Find("D:\\", "file.something", true, nil);
if (result1) then
strnew1 = Table.Concat(result1, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something",strnew1, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else
result2 = File.Find("E:\\", "file.something", true, nil);
if (result2) then
strnew2 = Table.Concat(result2, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something", strnew2, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else
Dialog.Message ("Error","File isnt found")
end
end
end
First - how to write script that search a file and if that file isnt on that partition search another etc.Also I need to copy a file from application to that one.And last I need dialog message to notify user that file is or isnt found
and when file is copied.
Because I don know almost anything about writing script dont laugh at my
attempt to write this one
*problem is that first dialog shows and then second dialog show that file was copied but it isnt*
Dialog.Message ("Please wait","File is being copying")
result = File.Find("C:\\", "file.something", true, nil);
if (result) then
strnew = Table.Concat(result, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something", strnew, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else -- if file isnt found search another partition
result1 = File.Find("D:\\", "file.something", true, nil);
if (result1) then
strnew1 = Table.Concat(result1, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something",strnew1, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else
result2 = File.Find("E:\\", "file.something", true, nil);
if (result2) then
strnew2 = Table.Concat(result2, "", 1, TABLE_ALL);
File.Copy("AutoPlay\\Docs\\file2.something", strnew2, true, true, false, true, nil);
Dialog.Message ("File is copied","OK")
else
Dialog.Message ("Error","File isnt found")
end
end
end