PDA

View Full Version : Save as a Text File


steven
08-08-2006, 06:27 AM
hello

I need some help, please :)

When i generate a TXT file, the file is generate always whit the same name, in this case MyFile.txt, what i would like to do is when i push the button that i can define the name of the file to save. Is it possible to create?

Text1a = Paragraph.GetText("Paragraph1");
Input1a = Input.GetText("Input1");
-- Table--
Result = {Text1a, Input1a}
-- create text File --
TextFile.WriteFromTable("C:\\MyFile.txt", Result, false);
-- how to make appear a save as window?? ---


tanks :yes

bule
08-08-2006, 06:56 AM
Here is the code:

Text1a = Paragraph.GetText("Paragraph1");
Input1a = Input.GetText("Input1");
-- Table--
Result = {Text1a, Input1a}

-- Browse --
MyFile = Dialog.FileBrowse(false, "Save As...", _DesktopFolder, "All Files (*.txt)|*.txt|", "MyFile", "txt", false, false);

if MyFile~="CANCEL" then
-- create text File --
TextFile.WriteFromTable(MyFile, Result, false);
end

steven
08-08-2006, 08:16 AM
tks bule for your time and your help, but when i press save it gives me this error :huh

http://img260.imageshack.us/img260/8218/untitleda1mq8.jpg


ERROR


http://img478.imageshack.us/img478/6901/untitled1ub7.jpg

:huh what i am doing wrong :huh

Tks :yes

TJ_Tigger
08-08-2006, 08:41 AM
The variable MyFile that is returned by the Dialog.FileBrowse is a table. When you test to see if it has been cancelled or if you want to use that variable you have to tell it which row to compare or use.

if MyFile[1] ~= "CANCEL" then

TextFile.WriteFromTable(MyFile[1], Result, false)

Tigg

steven
08-08-2006, 08:56 AM
Tanks TJ_Tigger and bule, it woks :yes :yes