Вот первое фото, это то что у нас есть.
а на втором надо добавить.
в етом скрипте
-- PDF Root Folder Defined in Global Functions
-- Variable: sPDFRootFolder
sFirstPDFToLoad = "";
function AddToTree(sFullPath)
if (sFirstPDFToLoad == '') then
sFirstPDFToLoad = sFullPath;
end
-- Split the path
tPathParts = String.SplitPath(sFullPath);
-- Get length of root folder (so we know how many chars to skip)
nRootLength = String.Length(sPDFRootFolder);
-- sFullPath minus last character
sFullFolderPath = tPathParts.Drive .. tPathParts.Folder;
nFullFolderPathLength = String.Length(sFullFolderPath);
sFullFolderPath = String.Mid(sFullFolderPath, 1, nFullFolderPathLength - 1);
-- Check of PDF should be inserted into root of tree
if(String.Compare(sPDFRootFolder, sFullFolderPath) == 0) then
-- We're inserting this PDF into the root, configure node values
tNodeData = {};
tNodeData['Text']=tPathParts.Filename;
tNodeData['Data']=sFullPath;
tNodeData['ImageIndex']="0";
-- Insert the node
Tree.InsertNode("Tree1", Tree.GetChildCount("Tree1", "0") + 1, tNodeData);
else
-- We need to search for an existing node by 'folder' value (ie sub folder) ... so let's create the search string
-- Initialize
sSearchString = tPathParts.Folder;
-- Strip the last slash off
sSearchString = String.TrimRight(sSearchString, '\\');
-- Find the last occuring slash (will be before the final folder name
nPosLastSlash = String.ReverseFind(sSearchString, '\\');
-- Get rid of all the stuff before the last occuring slash
sSearchString = String.Mid(sSearchString, nPosLastSlash + 1, -1);
-- Search the tree by node name (folder name)
sFoundNodeIndex = Tree.FindNodeByText("Tree1", "0", sSearchString);
if sFoundNodeIndex == "" then
-- Node wasn't found, create it
-- Create node data (data part is left blank ... this is a 'category', not a document)
tNodeData = {};
tNodeData['Text']=sSearchString;
tNodeData['Data']="";
tNodeData['ImageIndex']="1";
sParentIndex = Tree.GetChildCount("Tree1", "0") + 1;
Tree.InsertNode("Tree1", sParentIndex, tNodeData);
else
sParentIndex = sFoundNodeIndex;
end
-- Insert actual file
tNodeData = {};
tNodeData['Text']=tPathParts.Filename;
tNodeData['Data']=sFullPath;
tNodeData['ImageIndex']="0";
Tree.InsertNode("Tree1", sParentIndex .. "." .. (Tree.GetChildCount("Tree1", sParentIndex) + 1), tNodeData);
end
return true;
end
-- Find all PDF's in the folder
File.Find(sPDFRootFolder, "*.pdf", true, false, nil, AddToTree);
-- Load the first PDF
PDF.LoadFile("PDF1", sFirstPDFToLoad);