|
|||
|
i m trying to save a variable to a text file, the save diaglog box shows up, but no file is created?????
here is the code Quote:
|
|
|||
|
ya, now it saves a text file.
but why are the file contents as such Code:
[mydata] type=string value=abcdefghijklmnopqrstuvwxyz Code:
abcdefghijklmnopqrstuvwxyz mydata = "abcd efghi jklm nopqrst uvwxyz"; the output is Code:
[mydata] type=string value=abcd%20efghi%20jklm%20nopqrst%20uvwxyz and one more thing, is it possible to create an MS Excel file. if yes, pl guide how to. thanks ![]() |
|
|||
|
or try something like this:
Code:
mydata = "ABCDEFGHIJKLMNOPQRSTUVWZ";
var filter = "Data files(*.txt)|*.txt|";
var filename = Dialogs.fileSave(filter, ".txt");
if (filename)
{
file_stream = new FileStream(filename,"w");
trace(file_stream);
file_stream.writeLine(mydata);
//do file_stream.writeLine("&sometypeofdata="+mydata);
// if you want the '&var='mydata file structure
file_stream.close();
}//end of if(filename)
http://www.topcmm.com/forum/thread_1_737.html To do something instead like |
|
|||
|
You can assign a flag to the Dialog.fileSave method
Dialogs.fileSave([filter[, default_ext[, filename[, flags]]]]) flags Integer. Can be one of the following values OFN_READONLY 0x00000001 OFN_OVERWRITEPROMPT 0x00000002 OFN_HIDEREADONLY 0x00000004 OFN_NOCHANGEDIR 0x00000008 OFN_SHOWHELP 0x00000010 OFN_ENABLEHOOK 0x00000020 OFN_ENABLETEMPLATE 0x00000040 OFN_ENABLETEMPLATEHANDLE 0x00000080 OFN_NOVALIDATE 0x00000100 OFN_ALLOWMULTISELECT 0x00000200 OFN_EXTENSIONDIFFERENT 0x00000400 OFN_PATHMUSTEXIST 0x00000800 OFN_FILEMUSTEXIST 0x00001000 OFN_CREATEPROMPT 0x00002000 OFN_SHAREAWARE 0x00004000 OFN_NOREADONLYRETURN 0x00008000 OFN_NOTESTFILECREATE 0x00010000 OFN_NONETWORKBUTTON 0x00020000 OFN_NOLONGNAMES 0x00040000 OFN_EXPLORER 0x00080000 // new look commdlg OFN_NODEREFERENCELINKS 0x00100000 OFN_LONGNAMES 0x00200000 // force long names for 3.x modules OFN_ENABLEINCLUDENOTIFY 0x00400000 // send include message to callback OFN_ENABLESIZING 0x00800000 Eg. Dialogs.fileSave("Zip files(*.zip; *.gz)|*.zip; *.gz|Text files(*.txt)|*.txt|All files(*.*)|*.*|", null, null, /*OFN_OVERWRITEPROMPT*/2); |
|
|||
|
thanks, otherwise i was trying something like this
Code:
if (filename) {
if(File.exists(filename)){
checkC = Dialogs.msgBox(filename + "already exists.Do you want to replace it.", "Save As", 52);
if (checkC == 6){
file_stream = new FileStream(filename,"w");
trace(file_stream);
Dialogs.msgBox("File "+filename);
file_stream.writeLine(order);
file_stream.close();
}
} else{
file_stream = new FileStream(filename,"w");
trace(file_stream);
Dialogs.msgBox("File "+filename);
file_stream.writeLine(order);
file_stream.close();
}
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|