View Full Version : if else who's on first what's on secound
Bruce
01-29-2008, 08:22 PM
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.."mdbbu.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.."mdbbu.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.."mdbbu.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.."mdbbu.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.."mdbbu.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.."mdbbu.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);
AudioSam
01-30-2008, 12:39 AM
I didn't have all the files you reference but this might work.
You know I'm not real good so if it doesn't that's my excuse... : )
--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);
result = Dialog.Message("Notice", "Your backup is complete, it is also on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
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");
result = Dialog.Message("Notice", "Your backup is complete, it is now on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
end
end
Hope it works,
AudioSam
AudioSam
01-30-2008, 01:47 AM
There are places where you might have had a typos.
its in the mdbbu file name
Did you mean for some of these to have spaces and others not?
What you had might would have worked if corrected...
Sorry about the post above..
I don't think that was the problem..
AudioSam
RizlaUK
01-30-2008, 06:30 AM
looks to me like the last "end" is in the wrong place so the bottom bit of code will fire no matter what "aresult" is
try this: (not tested but looks right to me)
--YES
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
--###################### 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
else
--NO
--################################################## ################################################## ####
--result = Dialog.Message("Notice", "NO!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
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.."mdbbu.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
end
result = Dialog.Message("Notice", "Your backup is complete, it is now on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
AudioSam
01-30-2008, 06:33 AM
I am guessing at what all the code in red does.
I didn't do anything to the code in red.
I think this might work.
I changed it around so if I made a mess just kick it out.
It worked all the way thru.
I know you may change some things, I just put them in so
I could get it to work.
Forget about the other post.
--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
Ex = Dialog.Message("Notice", "Back-up is closing?", MB_OKCANCEL, MB_ICONQUESTION, MB_DEFBUTTON1);
if Ex == IDOK then
Application.Exit()
else
result2 = Dialog.Message("Notice", "Continue with backup?", MB_YESNO, MB_ICONQUESTION, MB_DEFBUTTON1);
if result2 ~= 6 then
Application.Exit()
else
Paragraph.SetText("Progress", "Creating Zip archive...");
Zip.Add(_DesktopFolder.."\\"..new_date_result.."mdbbu.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.."mdbbu.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");
Paragraph.SetText("Progress", "");
end
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 --YES B/U MY CONTACT DB
FTP.Disconnect ();
result = Dialog.Message("Notice", "Your backup is complete.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
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);
Application.ExitScript()
end
else
result = Dialog.Message("Notice", "Your backup is complete and on you Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--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);
end
--return true
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.."mdbbu.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.."\\mdbbu.zip", {_SourceFolder .. "\\AutoPlay\\Docs\\ckdb.db"}, true, "", 9, nil, false);
Zip.Add(_DesktopFolder.."\\"..new_date_result.."mdbbu.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.."\\mdbbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
Zip.Add(_DesktopFolder.."\\"..new_date_result.."mdbbu.zip", {"AutoPlay\\Docs\\*.enc"}, false, "", 9, ZipCallBack, true);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
Fin = Application.GetLastError()
if Application.GetLastError() ~= 0 then
Dialog.Message("Error", _tblErrorMessages[Fin], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
Progress.SetText("Plugin1", "");
Progress.SetCurrentPos("Plugin1", 0);
--CloseWin = Button.GetState("win Button");
end
end
end
end
result = Dialog.Message("Notice", "Your backup is complete, it is now on your Desktop.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
AudioSam
AudioSam
01-30-2008, 06:41 AM
I made a mess of this thing earlier.
I think the post above will work.
Glad to see you jump in...
Save Me........ : )
Oh well, I tried... :huh
AudioSam
Bruce
01-30-2008, 10:47 AM
looks to me like the last "end" is in the wrong place so the bottom bit of code will fire no matter what "aresult" is
Yeh I thought that may be the case, Thank you.
AudioSam
01-30-2008, 07:00 PM
Bruce,
There are several places where you refer to mdbbu.zip
Sometimes it is mdbbu.zip and others it is md bbu.zip
AudioSam
Bruce
01-31-2008, 12:21 AM
Bruce,
There are several places where you refer to mdbbu.zip
Sometimes it is mdbbu.zip and others it is md bbu.zip
AudioSam
Thanks I'll take a look :yes
Derek
02-01-2008, 02:51 AM
Quickly scrolling thru [didnt read the code] .. would a 'break' not work for you?
run the green code
if all went well then
break;
else
run the red code
end
type of deal
Just thinking out loud. Haven't tried it
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.