Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
util:jsexec [2010/04/15 14:23] – Links to custom:js changed to custom:javascript digitalmanutil:jsexec [2018/01/10 16:37] – [Module] Make note about relative paths and cwd. digital man
Line 48: Line 48:
 The ''module'' argument is optional if the standard input stream (''stdin'') is not a console (''tty''), allowing for [[#shebang]] support on Unix-like operating systems. The ''module'' argument is optional if the standard input stream (''stdin'') is not a console (''tty''), allowing for [[#shebang]] support on Unix-like operating systems.
  
 +**Note:**
 +When JSexec starts up, it changes its **current working directory** to the Synchronet ''[[dir:ctrl]]'' directory. If you pass filenames on the command-line to a module, the paths must be full/absolute paths or relative to the Synchronet ''[[dir:ctrl]]'' directory.
 ===== Additional Properties ===== ===== Additional Properties =====
  
 Additional properties available to JavaScript scripts running from JSexec: Additional properties available to JavaScript scripts running from JSexec:
  
-^Property  ^Type     ^Description^+^Property   ^ Type     ^Description^
 |''jsexec_revision'' |string|[[dev:CVS]] revision of JSexec (example: ''%%"1.135"%%'')| |''jsexec_revision'' |string|[[dev:CVS]] revision of JSexec (example: ''%%"1.135"%%'')|
 |''jsexec_revision_detail'' |string |Verbose details about the JSexec build (example: ''%%"JSexec 1.136 Debug  Compiled Mar 15 2010 11:13:53 with GCC 3.4.2"%%'')| |''jsexec_revision_detail'' |string |Verbose details about the JSexec build (example: ''%%"JSexec 1.136 Debug  Compiled Mar 15 2010 11:13:53 with GCC 3.4.2"%%'')|
-|''env'' |string[] |Associative array of system environment variables (example: ''%%env["shell"]="/bin/bash"%%'')|+|''env''    Object |Associative array of system environment variables (example: ''%%env["shell"]="/bin/bash"%%'')
 +|''stdin''  | File   |Standard input stream | 
 +|''stdout'' | File   |Standard output stream | 
 +|''stderr'' | File   |Standard error output stream |
  
 +===== Additional Functions =====
 +
 +The following global methods (functions) are also available to JavaScript scripts running from JSexec:
 +
 +^Function     ^ Return Value ^ Description ^
 +|''log''      | String       | Log a message   |
 +|''read''     | String       | Read from stdin |
 +|''readln''   | String       | Read line from stdin |
 +|''write''    | String       | Write a string to stdout |
 +|''print''    | String       | Write a line to stdout (a.k.a. ''writeln'') |
 +|''printf''   | String       | Write a formatted string to stdout |
 +|''alert''    | String       | Print an alert message on the console |
 +|''prompt''   | String       | Prompt for user input |
 +|''confirm''  | String       | Get a yes/no confirmation |
 +|''deny''     | String       | Get a no/yes confirmation |
 +|''chdir''    | String       | Change the current working directory |
 +|''putenv''   | String       | Add or change an environment variable |
 ===== conio ===== ===== conio =====
 JSexec includes an instance of a special Console Input/Output class called ''conio''. JSexec includes an instance of a special Console Input/Output class called ''conio''.