View Full Version : Need help with If then else statement Script
Please can someone help me:
Here what I want to do:
search for C:\windows If found
File.Copy("AutoPlay\\Docs\\file.txt", "C:\\windows\\", true, true, false, true, nil);
else
Search for D:\winodws folder If found
File.Copy("AutoPlay\\Docs\\file.txt", "D:\\windows\\", true, true, false, true, nil);
hope this is clear;
:huh
yosik
03-23-2007, 01:49 AM
if Folder.DoesExist("C:\\windows") then
File.Copy("AutoPlay\\Docs\\file.txt", "C:\\windows\\", true, true, false, true, nil);
elseif Folder.DoesExist("D:\\windows") then
File.Copy("AutoPlay\\Docs\\file.txt", "D:\\windows\\", true, true, false, true, nil);
end
and what happens if neither are found?
Hope that helps
Yossi
I think what he wants is to find the active Windows Folder.
if (Folder.DoesExist(_WindowsFolder)) then
File.Copy("AutoPlay\\Docs\\file.txt", _WindowsFolder, true, true, false, true, nil);
end
saves lines of not needed code. This will check and make sure that what ever drive you installed windows to that it's folder exits before it copies the file into it.
Yosik Great Its working, Thank you for your help..:yes
if neither are found I did like this
if Folder.DoesExist("C:\\test") then
File.Copy("AutoPlay\\Docs\\file.txt", "C:\\test\\", true, true, false, true, nil);
elseif Folder.DoesExist("D:\\test") then
File.Copy("AutoPlay\\Docs\\file.txt", "D:\\test\\", true, true, false, true, nil);
else
Dialog.Message ("Error", "Ohh no...... Test Folder Does Not Exist ");
end
Is this this the correct way?
Bags
I havent tried your script yet, I will try that and let you know soon. Thanks
Bags: your script dosent say which drive?
I think yosik one is works fine so..
Thanks for your reply too :yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.