This site permanently moved to
https://droidscript.github.io
. Please update links accordingly.
You are being forwarded automatically in 3...
[stay here]
Back
WriteFile
Hello World
Writes text to a local file.
app.WriteFile(
file
,
text
,
mode
,
encoding
)
See Also:
ReadFile
.
Example - Append file and get line count
click to expand contents
function
OnStart
(
)
{
app
.
WriteFile
(
"myFile.txt"
,
"Hello World from Write\n"
,
"Append"
)
;
var
txt
=
app
.
ReadFile
(
"myFile.txt"
)
;
var
length
=
txt
.
split
(
"\n"
)
.
length
;
app
.
ShowPopup
(
"myFile contains "
+
length
+
" lines"
)
;
}
Copy
Copy All
Run
String
String:
path to file (
“/absolute/...”
or
“relative/...”
)
String:
“Append”
or
“ASCII”
String:
“US-ASCII”
or
“UTF-8”
or
“UTF-16”
or
“UTF-16BE”
or
“UTF-16LE”
or
“windows-1252”
or
“
ISO-8859-1
”
loading