In this bit of code where I'm trying to do some "if else" side stepping. All the green area works well, It's the red area that fires even if the aresult is yes.
The else is not doing its job.
Can someone take a look see?
--YES
--###################### Look on page1 preload - does the user have the right to upload to the server (phones home)i.e. (aresult)######################################### ###########
if aresult == 1 then
result2 = Dialog.Message("Notice", "Did you want to do a backup.", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if result2 == 6 then
contact_result = Dialog.Message("Notice", "Would you like to back-up your contact data base at the same time?", MB_YESNO, MB_ICONINFORMATION, MB_DEFBUTTON1);
if contact_result == 6 then --YES B/U MY CONTACT DB
Paragraph.SetText("Progress", "Creating Zip archive...");
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
SQLite.Close(scontactdb);
sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\Contact Keeper\\ckdb.db";
Paragraph.SetText("Progress", "Adding Contact Keeper database…");
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {_SourceFolder .. "\\AutoPlay\\Docs\\Contact Keeper\\ckdb.db"}, true, "", 9, nil, false);
scontactdb = SQLite.Open(sDatabaseFile);
Paragraph.SetText("Progress", "Accessing server…");
FTP.Connect("www.mysite.com", "mylogin", "mypassword", "", true);
Paragraph.SetText("Progress", "Accessing Folder...");
FTP.ChangeDir("websites/mysite.com/docs/folder/folder");
Paragraph.SetText("Progress", "Uploading...");
FTP.SetTransferType(FTP.AUTO);
FTP.Upload(_DesktopFolder.."\\"..new_date_result.. "mdbbu.zip", new_date_result.."mdbbu.zip", FTPCallBack);
Paragraph.SetText("Progress", "Closing Server Connection");
FTP.Disconnect ();
Paragraph.SetText("Progress", "");
else--NO DO NOT B/U MY CONTACT DB
Paragraph.SetText("Progress", "Creating Zip archive...");
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
Paragraph.SetText("Progress", "Accessing server…");
FTP.Connect("www.mysite.com", "mylogon", "mypassword", "", true);
Paragraph.SetText("Progress", "Accessing Folder...");
FTP.ChangeDir("websites/mysite.com/docs/folder/folder");
Paragraph.SetText("Progress", "Uploading...");
FTP.SetTransferType(FTP.AUTO);
FTP.Upload(_DesktopFolder.."\\"..new_date_result.. "mdbbu.zip", new_date_result.."mdbbu.zip", FTPCallBack);
Paragraph.SetText("Progress", "Closing Server Connection");
FTP.Disconnect ();
Paragraph.SetText("Progress", "");
end
bu_result1 = Dialog.Message("Notice", "Would you like to delete the the backup zip file on your Desktop?.", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
if bu_result1 == 6 then
local tblAllFiles = File.Find(_DesktopFolder, "*mdbbu*", true, false, nil, nil);
for numFileIndex, strFilePath in tblAllFiles do
File.Delete(strFilePath, false, false, false, nil);
result = Dialog.Message("Notice", "Your backup is complete.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
else
result = Dialog.Message("Notice", "Your backup is complete, it is also on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
end
else
--NO
--################################################## ################################################## ####
--result = Dialog.Message("Notice", "NO!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
function FTPCallBack(nBytes, nTotal)
if nTotal == 0 then
nTotal = File.GetSize("AutoPlay\\Docs\\mdb.enc");
end
--Progress.SetText("Plugin1", "Uploading File");
Progress.SetRange("Plugin1", 0, 100);
nPercent = Math.Round(nBytes/nTotal *100, 0);
Progress.SetText("Plugin1", nPercent.."%");
Progress.SetCurrentPos("Plugin1", nPercent);
--return true
end
function ZipCallBack(sFile, nPercent, nStatus)
if nStatus == ZIP_STATUS_MAJOR then
Progress.SetText("Plugin1", sFile);
Progress.SetRange("Plugin1", 0, 100);
Progress.SetCurrentPos("Plugin1", nPercent)
end
end
contact_result = Dialog.Message("Notice", "Would you like to back-up your contact data base at the same time?", MB_YESNO, MB_ICONINFORMATION, MB_DEFBUTTON1);
if contact_result == 6 then
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
SQLite.Close(scontactdb);
sDatabaseFile = _SourceFolder .. "\\AutoPlay\\Docs\\Contact Keeper\\ckdb.db";
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {_SourceFolder .. "\\AutoPlay\\Docs\\ckdb.db"}, true, "", 9, nil, false);
scontactdb = SQLite.Open(sDatabaseFile);
Dialog.Message("Contact Data Base", "Your contacts have been added to your backup!", MB_OK, MB_ICONEXCLAMATION);
else
Zip.Add(_DesktopFolder.."\\"..new_date_result.."md bbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
if Application.GetLastError() == 0 then
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
--CloseWin = Button.GetState("win Button");
end
end
result = Dialog.Message("Notice", "Your backup is complete, it is now on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

Reply With Quote
