Search completed in 0.99 seconds.
13 results for "writeString":
writeString - Archive of obsolete content
method of winprofile object syntax boolean
writestring ( string section, string key, string value); parameters the method has the following parameters: section section in the file, such as "boot" or "drivers".
... description the
writestring method is similar to the windows api function writeprivateprofilestring.
... example to set the name of the wallpaper file from the desktop section of the win.ini file, use this call: ini = getwinprofile (getfolder("windows"), "win.ini"); ini.
writestring ("desktop", "wallpaper", "newpathname"); ...
Writing to Files - Archive of obsolete content
for text files, you will usually use the
writestring method.
... var file = io.getfile("desktop", "myinfo.txt"); var stream = io.newoutputstream(file, "text"); stream.
writestring("this is some text"); stream.close(); in this example, a text input stream is created for the file 'myinfo.txt'.
... the
writestring method is called to write a single string to the file, supplied as an argument to the method.
...And 2 more matches
nsIWindowsRegKey
e); void removechild(in astring relpath); void removevalue(in astring name); void startwatching(in boolean recurse); void stopwatching(); void writebinaryvalue(in astring name, in acstring data); void writeint64value(in astring name, in unsigned long long data); void writeintvalue(in astring name, in unsigned long data); void
writestringvalue(in astring name, in astring data); attributes attribute type description childcount unsigned long this attribute returns the number of child keys.
...note: unlike
writestringvalue(), readstringvalue() will work with reg_multi_sz and reg_expand_sz types.
...
writestringvalue() this method writes the unicode string contents of the named value.
...void
writestringvalue( in astring name, in astring data ); parameters name the name of the value to modify.
nsIBinaryOutputStream
(in pruint8 abyte); void write16(in pruint16 a16); void write32(in pruint32 a32); void write64(in pruint64 a64); void writeboolean(in prbool aboolean); void writebytearray([array, size_is(alength)] in pruint8 abytes, in pruint32 alength); void writebytes(alength)] in string astring, in pruint32 alength); void writedouble(in double adouble); void writefloat(in float afloat); void
writestringz(in string astring); void writeutf8z(in wstring astring); void writewstringz(in wstring astring); methods setoutputstream() sets the stream to which output is directed.
...
writestringz() writes an 8-bit pascal style string to the stream.
...void
writestringz( in string astring ); parameters astring the string to write to the stream.
Writing textual data - Archive of obsolete content
fox 1.5), you can use nsiconverteroutputstream: var charset = "utf-8"; // can be any character encoding name that mozilla supports var os = components.classes["@mozilla.org/intl/converter-output-stream;1"] .createinstance(components.interfaces.nsiconverteroutputstream); // this assumes that fos is the nsioutputstream you want to write to os.init(fos, charset, 0, 0x0000); os.
writestring("umlaute: \u00fc \u00e4\n"); os.
writestring("hebrew: \u05d0 \u05d1\n"); // etc.
... os.close(); you can also write character arrays using the write function, although using
writestring is simpler from javascript code.
File I/O - Archive of obsolete content
createinstance(components.interfaces.nsiconverteroutputstream); converter.init(fostream, "utf-8", 0, 0); converter.
writestring(data); converter.close(); // this closes fostream note: the file status flags used in the nsifileoutputstream.init() function are documented in pr_open.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
teinstance(components.interfaces.nsifileoutputstream); filestream.init(file, 2, 0x200, false); var converterstream = components .classes['@mozilla.org/intl/converter-output-stream;1'] .createinstance(components.interfaces.nsiconverteroutputstream); converterstream.init(filestream, charset, string.length, components.interfaces.nsiconverterinputstream.default_replacement_character); converterstream.
writestring(string); converterstream.close(); filestream.close(); character encoding conversion firefox's internal representation of all text is in unicode.
Windows Install - Archive of obsolete content
var fren8dot3ini = getwinprofile(ftemp, "ren8dot3.ini"); var binicreated = false; var flongfilepath; var sshortfilepath; if(fren8dot3ini != null) { for(i = 0; i < listlongfilepaths.length; i++) { flongfilepath = getfolder(fprogram, listlongfilepaths[i]); sshortfilepath = file.windowsgetshortname(flongfilepath); if(sshortfilepath) { fren8dot3ini.
writestring("rename", sshortfilepath, flongfilepath); binicreated = true; } } if(binicreated) updatewinreg4ren8dot3() ; } return(0); } // main var srdest; var err; var fprogram; srdest = 449; err = initinstall(prettyname, regname, "6.0.0.2000110801"); logcomment("initinstall: " + err); fprogram = getfolder("program"); logcomment("fprogram: " + fprogram); if...
XPInstall API reference - Archive of obsolete content
rremove dirrename diskspaceavailable execute exists isdirectory isfile macalias moddate moddatechanged move remove rename size windowsgetshortname windowsregisterserver windowsshortcut winprofile no properties methods getstring
writestring winreg no properties methods createkey deletekey deletevalue enumkeys enumvaluenames getvalue getvaluenumber getvaluestring iskeywritable keyexists setrootkey setvalue setvaluenumber setvaluestring valueexists winregvalue constructor other...
Accessing the Windows Registry Using XPCOM
this example demonstrates writing a new string value: var wrk = components.classes["@mozilla.org/windows-registry-key;1"] .createinstance(components.interfaces.nsiwindowsregkey); wrk.create(wrk.root_key_current_user, "software\\mdc\\test", wrk.access_write); wrk.
writestringvalue("testvalue", "hello world!"); wrk.close(); checking the existence of keys and values before you attempt to read a value or open a child key, you should check to see whether it exists first.
nsIScriptableIO
example: writing to a file var json = "{ name: 'bob', age: 37}"; var file = io.getfile("profile", null); file.append("myobject.json"); if (!file.exists()) file.create(ci.nsifile.normal_file_type, 0600); var stream = io.newoutputstream(file, "text write create truncate"); stream.
writestring(json); stream.close(); example: reading from a file var file = io.getfile("profile", null); file.append("localstore.json"); if (file.exists()) { var stream = io.newinputstream(file, "text"); var json = stream.readline(); stream.close(); } see also nsifile, nsiinputstream, nsioutputstream ...