User Tools

Site Tools


built_in:sys_proc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
built_in:sys_proc [2015/11/11 20:19]
67.58.20.7 [Table]
built_in:sys_proc [2015/11/12 07:23] (current)
Line 4: Line 4:
 Some controls use the same methods.\\ Some controls use the same methods.\\
 For examples of the **[[same methods]]** look here. For examples of the **[[same methods]]** look here.
-^ Method                    ^ Description                                                                                                                                                                                                                                                                                                                                                                                                                                                        +^ Method                               ^ Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
-| Sys.Out( cmd )            | cmd will be passed to shell.  For example, "echo hi >/sdcard/out.txt\n" To obtain execution results, redirect standard out (>) and/or stderr (2>) to a temporary file in a writable directory, then read it back in using app.ReadFile().  NOTE: It is important to include the newline character at the end (\n).  Otherwise, your system procedure will only work the first time, and subsequent times will delay output until the DroidScript's termination. +| Sys.Out( cmd )                       | cmd will be passed to shell.  For example, ''"echo hi >/sdcard/out.txt\n"''.  To obtain execution results, redirect standard out (>) and/or stderr (2>) to a temporary file in a writable directory, then read it back in using app.ReadFile().  **NOTE: It is important to include the newline character at the end (\n).  Otherwise, your system procedure will only work the first time, and subsequent times will delay output until the DroidScript's termination.**  Also note that output may not be immediately available.  As a workaround, If the output file does not exist yet, you can use setTimeout() to poll for output repeatedly until it arrives.  | 
-| Sys.ReadFileAsByte( p1                                                                                                                                                                                                                                                                                                                                                                                                                                                                     +| Sys.ReadFileAsByte( filename       Return the decimal number for the ASCII code of the first byte of the named file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
-| Sys.WriteToFile( p1                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |+| Sys.WriteToFile( filename, string  Write the specified string to the named file.  (app.WriteFile does the same)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  
 +===== Sample =====
 +[[sample_code:sys_out|Example use of Sys.Out()]]
built_in/sys_proc.1447273140.txt.gz · Last modified: 2015/11/12 04:19 (external edit)