Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014

    if else who's on first what's on secound

    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);

  2. #2
    Join Date
    Jan 2007
    Posts
    271

    Hi Bruce

    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... : )

    Code:
    --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

  3. #3
    Join Date
    Jan 2007
    Posts
    271

    I noticed something...

    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
    Last edited by AudioSam; 01-30-2008 at 12:54 AM.

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    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)
    Code:
    --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);
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Jan 2007
    Posts
    271

    Arrow Hello Bruce

    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.

    Code:
    --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
    Last edited by AudioSam; 01-30-2008 at 05:36 AM.

  6. #6
    Join Date
    Jan 2007
    Posts
    271

    Hi Rizla

    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...
    AudioSam

  7. #7
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Quote Originally Posted by RizlaUK View Post
    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.

  8. #8
    Join Date
    Jan 2007
    Posts
    271

    Hmmm...

    Bruce,


    There are several places where you refer to mdbbu.zip
    Sometimes it is mdbbu.zip and others it is md bbu.zip

    AudioSam

  9. #9
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Quote Originally Posted by AudioSam View Post
    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

  10. #10
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244
    Quickly scrolling thru [didnt read the code] .. would a 'break' not work for you?

    Code:
    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
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts