System
Table of contents
Global functions
cancel()
Stops the current system operation that triggered the event. Useful for preventing operations during validation phases.
This method works only in triggers or event scripts executed before saving or before creating an entry.
Returns
void
Example
// Prevent saving if validation fails
if (!isValid) {
log("Validation failed - canceling save");
cancel();
}
exit()
Terminates script execution immediately.
Returns
void
Example
log("Performing early exit");
exit();
system()
Returns information about the current system environment.
Returns
System object
Example
let sys = system();
log("Operating system: " + sys.os);
log("Current user: " + sys.username);
guid()
Generates a random unique identifier string.
Returns
String - Random identifier
Example
let uniqueId = guid();
log("Generated ID: " + uniqueId);
intent(action)
android
Creates an Intent object for inter-application communication (Android only).
Parameters
Parameter | Type | Description |
---|---|---|
action | String | Standard Android intent action (e.g., “android.intent.action.VIEW”) |
Returns
Intent object
Example
// Create intent to dial a phone number
let i = intent("android.intent.action.DIAL");
i.data("tel:+1234567890");
i.send();
System Object
Properties
Property | Type | Description |
---|---|---|
os | String | Operating system name |
username | String | Current user’s username |
Intent Object
Represents an Android Intent for inter-application communication.
data(uri)
Sets the data URI for the intent.
Parameters
Parameter | Type | Description |
---|---|---|
uri | String | URI for the data (e.g., “tel:”, “mailto:”, file path) |
Returns
void
Example
let i = intent("android.intent.action.VIEW");
i.data("http://example.com");
extra(key, value)
Adds extra data to the intent as key-value pairs.
Parameters
Parameter | Type | Description |
---|---|---|
key | String | Key identifier for the extra data |
value | Any | Value to associate with the key |
Returns
void
Example
let i = intent("android.intent.action.SEND");
i.extra("android.intent.extra.TEXT", "Hello World");
extraLong(key, value)
Adds extra data specifically as Long type values.
Parameters
Parameter | Type | Description |
---|---|---|
key | String | Key identifier for the extra data |
value | Number | Long value to associate with the key |
Returns
void
Example
// Calendar event example
let i = intent("android.intent.action.INSERT");
i.data("content://com.android.calendar/events");
i.extraLong("beginTime", new Date().getTime());
mimeType(mime)
Sets the MIME type for the intent data.
Parameters
Parameter | Type | Description |
---|---|---|
mime | String | MIME type (e.g., “text/plain”, “image/jpeg”) |
Returns
void
Example
let i = intent("android.intent.action.SEND");
i.mimeType("text/plain");
send()
Executes the intent, sending it to the Android system.
Returns
void
Example
// Complete SMS example
let i = intent("android.intent.action.SENDTO");
i.data("smsto:+1234567890");
i.extra("sms_body", "Hello from Memento!");
i.send();