PDA

View Full Version : How to set DB File Path "Help"



mjmfgm
01-11-2008, 11:57 AM
I need to change a button action over to a file path setting, what I mean by that is I need to change the "MD5DB.md5" button click event over to a path without having to click on a button.

..........................Old Code ................................................
-- Prompt the user for a db file to load and check for error
tFiles = Dialog.FileBrowse(true, "Load MD5 Digests DB", "", "MD5 DB (*.md5)|*.md5|", "", "md5", false, true);

err = CheckError("Load MD5 Button: Dialog.FileBrowse");

-- was the load successful?
if err == 0 then
Yes, it was. Did the user press cancel?
if tFiles[1] ~= 'CANCEL' then
-- The user did not press cancel, set db path to file path
sDBPath = tFiles[1];
end
end

..............................My Code New code ..........................................
-- Search the user's My Documents folder for the file "Data.ini".
search_results = File.Find("AutoPlay", "MD5DB.md5", true, false, nil, nil);
--Check to see if an error occurred during the search. If it did, display ---------the error message.

error = Application.GetLastError();
if error ~= 0 then
Dialog.Message("Error",_tblErrorMessages[error]);
else

message = "MD5DB.md5 was found in the following location(s). (s):\r\n\r\n";

for index, path in search_results do
message = String.Concat(message, path.."\r\n");


sDBPath = search_results[0];

end
.................................................. ................................................
The file is found and is diplayed in a dialog, however the path does not get called ? Any Ideas what I am doing wrong ?