mobileFX WebKitX ActiveX
WebKitX JavaScript Externs~-_namespace / WriteTextFile Method
Absolute path and file name of the file.
Text to save.
Reserved, this must be "UTF-8".
In This Topic
    WriteTextFile Method
    In This Topic
    WriteTextFile saves UTF-8 text to a file with BOM UTF-8 encoding.
    Syntax
    var value; // Type: boolean
    
    // Parameters
    var FileName; // Type:  string
    var Text; // Type:  string
    var Encoding; // Type:  string
    
    value = WriteTextFile(FileName, Text, Encoding);
    function WriteTextFile( 
       FileName : string,
       Text : string,
       Encoding : string
    ) : boolean;

    Parameters

    FileName
    Absolute path and file name of the file.
    Text
    Text to save.
    Encoding
    Reserved, this must be "UTF-8".
    Example
    function OnDesignerSaveFormAs(e, no_dialog)
    {
    	var title = "Save WebForm";
    	var path = APP_PATH;
    	var filename = WEB_FORM.filename || WEB_FORM[$NAME] + ".json";
    	var filter = "WebForm JSON File|*.json|All Files|*.*";
    
    	if (!filename || no_dialog == undefined)
    	{
    		filename = ShowSaveFileDialog(title, path, filter, filename);
    	}
    
    	if (filename) 
    	{
    		EditorReadCurrentViewState();
    
    		var FORM = {
    			
    			CONTROLS: [],
    			
    			CLIENT_TIER_SCRIPT: CLIENT_TIER.model.getValue(),
    			CLIENT_BREAKPOINTS: EditorGetModelBreakPoints(CLIENT_TIER.model),
    			CLIENT_TIER_VIEW: CLIENT_TIER.viewstate,
    
    			SERVER_TIER_SCRIPT: SERVER_TIER.model.getValue(),			
    			SERVER_BREAKPOINTS: EditorGetModelBreakPoints(SERVER_TIER.model),
    			SERVER_TIER_VIEW: SERVER_TIER.viewstate,
    
    			SQL_STATEMENTS: db_statements(),
    			W2_CONTROL_INDEX: W2_CONTROL_INDEX,
    		};
    
    		FORM.CONTROLS = w2ui_webform_controls();
    		var json = JSON.stringify(FORM, null, "\t");
    		WriteTextFile(filename, json, "utf-8");
    		WEB_FORM.filename = filename;
    		
    		$("#x-w2ui-menu-save-as").w2tag({			
    			html: "Saved " + filename,
    			hideOnKeyPress: true,
    			hideOnBlur: true, 
    			hideOnClick: true,
    		});
    	}
    }
    Browser Compatibility
    80