PDA

View Full Version : i need to change this code to automatic open the file without choice the file



lnd
10-15-2005, 10:31 AM
i need to change this code to automatic open the file without choice the file
without Dialog.FileBrowse

the code is open a text file and insert it to the tree object.

file = Dialog.FileBrowse(true, "Locate File", "c:\\", "(*.txt)|*.txt|", "1.txt", "txt", false, true);

Paragraph.SetText("Paragraph1", TextFile.ReadToString(file[1]));
t_Text= TextFile.ReadToTable(file[1]);
t_Node={};
t_Node.Expanded=true;
t_anz=Table.Count(t_Text);
t_Node.Text=t_Text[1];

Tree.InsertNode("Tree1", "1", t_Node);
for x=2,t_anz do
t_Node.Text=t_Text[x];
result = Tree.InsertNode("Tree1", "1."..x, t_Node);

end

Stefan_M
10-15-2005, 11:20 AM
--set file to load
file = "f:\\file.txt";
--read the Textfile into a table
t_Text= TextFile.ReadToTable(file);
--create table for node properties
t_Node={};
--set node property "Expand" to true
t_Node.Expanded=true;
t_anz=Table.Count(t_Text);
t_Node.Text=t_Text[1];
--insert first entry with level 1
Tree.InsertNode("Tree1", "1", t_Node);
for x=2,t_anz do
t_Node.Text=t_Text[x];
result = Tree.InsertNode("Tree1", "1."..x, t_Node);
end;



Stefan_M