I am trying to create a document browser and have followed the knowledge base directions. That works fine, but I want to take it to the next level.
I want it to goto a folder on the cd and list all the PDF files. I have got it to list pdf files but can't get it to goto a specified folder.
Next problem, I also have to embedded Adobe Reader on the cd since LE can't install software without the Chief's ok. I know how to that and have, but with the list box whenI click on the file I want it opens that as well as the first file in the list. Here is the code I am using:
--Disable listbox Updating ListBox.SetUpdate("ListBox1", false);
--Get the desired folder to browse
folder = Dialog.FolderBrowse("Open Folder", "_SourceFolder\\Docs\\");
--populate a table with all the .pdf files
file = File.Find(folder, "*.pdf", false, false, nil);
--do the following for each file:
for j, file_path in file do
--add the item to the listbox, with the name visible and path as data
ListBox.AddItem("ListBox1", String.SplitPath(file_path).Filename, file_path);
end
--Allow the listbox to display the updated content ListBox.SetUpdate("ListBox1", true);
Here is the open code:
path_short = File.GetShortName(_SourceFolder);
File.Run("AutoPlay\\Adobe Reader\\AcroRd32.exe", path_short .. "\\AutoPlay\\Docs\\*.pdf", "", SW_SHOWNORMAL, false);
selected = ListBox.GetSelected("ListBox1");
for j,k in selected do
File.Open(ListBox.GetItemData("ListBox1", k),"", SW_SHOWNORMAL);
end
I want it to goto a folder on the cd and list all the PDF files. I have got it to list pdf files but can't get it to goto a specified folder.
Next problem, I also have to embedded Adobe Reader on the cd since LE can't install software without the Chief's ok. I know how to that and have, but with the list box whenI click on the file I want it opens that as well as the first file in the list. Here is the code I am using:
--Disable listbox Updating ListBox.SetUpdate("ListBox1", false);
--Get the desired folder to browse
folder = Dialog.FolderBrowse("Open Folder", "_SourceFolder\\Docs\\");
--populate a table with all the .pdf files
file = File.Find(folder, "*.pdf", false, false, nil);
--do the following for each file:
for j, file_path in file do
--add the item to the listbox, with the name visible and path as data
ListBox.AddItem("ListBox1", String.SplitPath(file_path).Filename, file_path);
end
--Allow the listbox to display the updated content ListBox.SetUpdate("ListBox1", true);
Here is the open code:
path_short = File.GetShortName(_SourceFolder);
File.Run("AutoPlay\\Adobe Reader\\AcroRd32.exe", path_short .. "\\AutoPlay\\Docs\\*.pdf", "", SW_SHOWNORMAL, false);
selected = ListBox.GetSelected("ListBox1");
for j,k in selected do
File.Open(ListBox.GetItemData("ListBox1", k),"", SW_SHOWNORMAL);
end
Comment