Route Script

Route Script Development Description

The Route Script system defines the behavior and logic of your app using a JSON-based command structure. It allows you to control navigation, user actions, data handling, and conditional logic without writing traditional code. Each command in the script represents an action, a condition, or a sequence, enabling dynamic app behavior.


Key Features

  • Variables: Store and manipulate values (var).
  • Conditional Logic: Control flow with if, elif, else, and when-case constructs.
  • Navigation: Navigate between pages using page, page-finish, timeout, and timeout-finish.
  • User Actions: Trigger actions like buy, use, login, chat, orders, tickets, and online-support.
  • Communication: Send email, sms, or make calls.
  • Content Display: Show media using photo, video, pdf, web, and download.
  • Utility: Perform operations like copy, share, toast, eval, set, delay, wallet, reset, and more.
  • Account Management: Handle logout, change-pass, change-name, delete-account, charge, and update.

Command Name Arguments Has Commands Description
var name, value No Declare a variable with a name and value
if exp Yes Conditional execution if expression is true
elif exp Yes Conditional execution if previous if/elif failed
else - Yes Executes commands if previous if/elif conditions failed
when - Yes Start of a when-case block
case value Yes A case inside a when block
else (when) - Yes Default case for when block
yeno title, text Yes Display a Yes/No dialog message with title and text
buy product, price Yes Purchase a product with specified price
buy-use product, price Yes Purchase and immediately use the product
use product Yes Use a product
login - No Login the user
page pageName No Navigate to a page
page-finish pageName No Finish or exit a page
timeout pageName, timeout No Set a timeout for a page
timeout-finish pageName, timeout No Finish timeout for a page
finish - No Finish the current page
day-night - No Toggle day/night mode
reset - No Reset variables or state
open url No Open a URL in browser
call phone No Make a phone call
email email, subject, text No Send an email
sms phone, text No Send an SMS
copy text No Copy text to clipboard
share text No Share text through system share
toast text No Show a temporary toast message
chat email No Open chat with specified email
orders - No Show user orders
tickets - No Show tickets
online-support - No Access online support
clean key No Remove a variable
clean-starts keys No Remove variables starting with specified keys
clean-likes keys No Remove variables containing specified keys
clean-ends keys No Remove variables ending with specified keys
photo url No Display a photo from URL
video url No Display a video from URL
pdf url No Display a PDF from URL
web url No Open a web page
download url No Download a file
download-open url No Download a file and open it
eval name, exp No Evaluate an expression and store result in variable
send listingType No Send a listing type
wallet - No Open wallet
dialog pageName No Open a dialog page
menu pageName No Open a menu page
logout - No Logout the user
change-pass - No Change user password
change-name - No Change user display name
delete-account - No Delete user account
charge product, price No Charge a product or service
about - No Show app information
update - No Check for app updates
app appID No Open another app by ID
send-ticket - No Send a support ticket
send-chat - No Send a chat message
locale locale No Set the application locale
set name, field, value No Set a field value for a named variable
delay timeout No Delay execution for specified timeout

var (name, value)

Usage: Declare a variable with a name and value

Arguments Type Default Value Description
Name String {name} Name of the variable
Value String {value} Value of the variable

Coding:

{
  "name": "var",
  "args": ["{name}","{value}"]
}

if (exp)

Usage: Conditional execution if expression is true

Arguments Type Default Value Description
Expression String {exp} Expression and Conditions

Coding:

{
  "name": "if",
  "args": ["{exp}"],
  "cmds": []
}

elif (exp)

Usage: Conditional execution if previous if/elif failed

Arguments Type Default Value Description
Expression String {exp} Expression and Conditions

Coding:

{
  "name": "elif",
  "args": ["{exp}"],
  "cmds": []
}

else

Usage: Executes commands if previous if/elif conditions failed

Coding:

{
  "name": "else",
  "cmds": []
}

when

Usage: Start of a when-case block

Coding:

{
  "name": "when",
  "cmds": []
}

when-case

Usage: A case inside a when block

Arguments Type Default Value Description
Value String {value} Value of when-case

Coding:

{
  "name": "case",
  "args": ["{value}"],
  "cmds": []
}

when-else

Usage: Default case for when block

Coding:

{
  "name": "else",
  "cmds": []
}

yeno (title, text)

Usage: Display a Yes/No dialog message with title and text

Arguments Type Default Value Description
Title String {title} Title of Yes/No Dialog
Text String {text} Text of Yes/No Dialog

Coding:

{
  "name": "yeno",
  "args": ["{title}","{text}"],
  "cmds": []
}

buy (product, price)

Usage: Purchase a product with specified price

Arguments Type Default Value Description
Product String {product} Product Name
Price Number {price} Product Price

Coding:

{
  "name": "buy",
  "args": ["{product}","{price}"],
  "cmds": []
}

buy-use (product, price)

Usage: Purchase and immediately use the product

Arguments Type Default Value Description
Product String {product} Product Name
Price Number {price} Product Price

Coding:

{
  "name": "buy-use",
  "args": ["{product}","{price}"],
  "cmds": []
}

use (product, price)

Usage: Use a product

Arguments Type Default Value Description
Product String {product} Product Name

Coding:

{
  "name": "use",
  "args": ["{product}"],
  "cmds": []
}

login ()

Usage: Login the user

Coding:

{
  "name": "login"
}

page (pageName)

Usage: Navigate to a page

Arguments Type Default Value Description
PageName PageName {pageName} Page Name for opening this page

Coding:

{
  "name": "page",
  "args": ["{pageName}"]
}

page-finish (pageName)

Usage: Finish or exit a page

Arguments Type Default Value Description
PageName PageName {pageName} Page Name for opening this page

Coding:

{
  "name": "page-finish",
  "args": ["{pageName}"]
}

timeout (pageName, timeout)

Usage: Set a timeout for a page

Arguments Type Default Value Description
PageName PageName {pageName} Page Name for opening this page
Timeout Number {timeout} Timeout of opening page

Coding:

{
  "name": "timeout",
  "args": ["{pageName}","{timeout}"]
}

timeout-finish (pageName, timeout)

Usage: Finish timeout for a page

Arguments Type Default Value Description
PageName PageName {pageName} Page Name for opening this page
Timeout Number {timeout} Timeout of opening page

Coding:

{
  "name": "timeout-finish",
  "args": ["{pageName}","{timeout}"]
}

finish ()

Usage: Finish the current page

Coding:

{
  "name": "finish"
}

day-night ()

Usage: Toggle day/night mode

Coding:

{
  "name": "day-night"
}

reset ()

Usage: Reset variables or state

Coding:

{
  "name": "reset"
}

open (url)

Usage: Open a URL in browser

Arguments Type Default Value Description
URL URL {url} URL of opening app

Coding:

{
  "name": "open",
  "args": ["{url}"]
}

call (phone)

Usage: Make a phone call

Arguments Type Default Value Description
Phone Phone {phone} Phone Number for calling
{
  "name": "call",
  "args": ["{phone}"]
}

email (email, subject, text)

Usage: Send an email

Arguments Type Default Value Description
Email Email {email} Email address for sending email
Subject String {subject} Subject of email
Text String {text} Content of email

Coding:

{
  "name": "email",
  "args": ["{email}","{subject}","{text}"]
}

sms (phone, text)

Usage: Send an SMS

Arguments Type Default Value Description
Phone Phone {phone} Phone Number for SMS
Text String {text} Text of message

Coding:

{
  "name": "sms",
  "args": ["{phone}","{text}"]
}

copy (text)

Usage: Copy text to clipboard

Arguments Type Default Value Description
Text String {text} Text for copy

Coding:

{
  "name": "copy",
  "args": ["{text}"]
}

share (text)

Usage: Share text through system share

Arguments Type Default Value Description
Text String {text} Text for share

Coding:

{
  "name": "share",
  "args": ["{text}"]
}

toast (text)

Usage: Show a temporary toast message

Arguments Type Default Value Description
Text String {text} Text for showing toast

Coding:

{
  "name": "toast",
  "args": ["{text}"]
}

chat (email)

Usage: Open chat with specified email

Arguments Type Default Value Description
Email Email {email} Email of chat

Coding:

{
  "name": "chat",
  "args": ["{email}"]
}

orders ()

Usage: Show user orders

Coding:

{
  "name": "orders"
}

tickets ()

Usage: Show tickets

Coding:

{
  "name": "tickets"
}

online-support ()

Usage: Access online support

Coding:

{
  "name": "online-support"
}

clean (key)

Usage: Remove a variable

Arguments Type Default Value Description
Key String {key} Key name for clean

Coding:

{
  "name": "clean",
  "args": ["{key}"]
}

clean-starts (keys)

Usage: Remove variables starting with specified keys

Arguments Type Default Value Description
Keys String {keys} Key names for clean

Coding:

{
  "name": "clean-starts",
  "args": ["{keys}"]
}

clean-likes (keys)

Usage: Remove variables containing specified keys

Arguments Type Default Value Description
Keys String {keys} Key names for clean

Coding:

{
  "name": "clean-likes",
  "args": ["{keys}"]
}

clean-ends (keys)

Usage: Remove variables ending with specified keys

Arguments Type Default Value Description
Keys String {keys} Key names for clean

Coding:

{
  "name": "clean-ends",
  "args": ["{keys}"]
}

photo (url)

Usage: Display a photo from URL

Arguments Type Default Value Description
URL URL {url} URL of photo

Coding:

{
  "name": "photo",
  "args": ["{url}"]
}

video (url)

Usage: Display a video from URL

Arguments Type Default Value Description
URL URL {url} URL of video

Coding:

{
  "name": "video",
  "args": ["{url}"]
}

pdf (url)

Usage: Display a PDF from URL

Arguments Type Default Value Description
URL URL {url} URL of PDF

Coding:

{
  "name": "pdf",
  "args": ["{url}"]
}

web (url)

Usage: Open a web page

Arguments Type Default Value Description
URL URL {url} URL of website

Coding:

{
  "name": "web",
  "args": ["{url}"]
}

download (url)

Usage: Download a file

Arguments Type Default Value Description
URL URL {url} URL of file

Coding:

{
  "name": "download",
  "args": ["{url}"]
}

download-open (url)

Usage: Download a file and open it

Arguments Type Default Value Description
URL URL {url} URL of file

Coding:

{
  "name": "download-open",
  "args": ["{url}"]
}

eval (name, exp)

Usage: Evaluate an expression and store result in variable

Arguments Type Default Value Description
Name String {name} Variable Name
Expression String {exp} Expression in this variable

Coding:

{
  "name": "eval",
  "args": ["{name}","{exp}"]
}

send (listingType)

Usage: Send a listing type

Arguments Type Default Value Description
ListingType ListingType {listingType} Listing Type for sending data

Coding:

{
  "name": "send",
  "args": ["{listingType}"]
}

wallet ()

Usage: Open wallet

Coding:

{
  "name": "wallet"
}

dialog (pageName)

Usage: Open a dialog page

Arguments Type Default Value Description
PageName PageName {pageName} Page name of launched dialog

Coding:

{
  "name": "dialog",
  "args": ["{pageName}"]
}

menu (pageName)

Usage: Open a menu page

Arguments Type Default Value Description
PageName PageName {pageName} Page name of launched menu

Coding:

{
  "name": "menu",
  "args": ["{pageName}"]
}

logout ()

Usage: Logout the user

Coding:

{
  "name": "logout"
}

change-pass ()

Usage: Change user password

Coding:

{
  "name": "change-pass"
}

change-name ()

Usage: Change user display name

Coding:

{
  "name": "change-name"
}

delete-account ()

Usage: Delete user account

Coding:

{
  "name": "delete-account"
}

charge (product, price)

Usage: Charge a product or service

Arguments Type Default Value Description
Product String {product} Product name of charging wallet
Price String {product} Price of this product

Coding:

{
  "name": "charge",
  "args": ["{product}","{price}"]
}

about ()

Usage: Show app information

Coding:

{
  "name": "about"
}

update ()

Usage: Check for app updates

Coding:

{
  "name": "update"
}

app (appID)

Usage: Open another app by ID

Arguments Type Default Value Description
AppID AID {appID} AppID for launching Applin App inside this app

Coding:

{
  "name": "app",
  "args": ["{appID}"]
}

send-ticket ()

Usage: Send a support ticket

Coding:

{
  "name": "send-ticket"
}

send-chat ()

Usage: Send a chat message

Coding:

{
  "name": "send-chat"
}

locale (locale)

Usage: Set the application locale

Arguments Type Default Value Description
Locale Locale {locale} Locales such as "en", "fa", etc

Coding:

{
  "name": "locale",
  "args": ["{locale}"]
}

set (name, field, value)

Usage: Set a field value for a named variable

Arguments Type Default Value Description
Name String {name} Element name
Field String {field} Field name of element
Value String {value} new set value for field of element

Coding:

{
  "name": "set",
  "args": ["{name}","{field}","{value}"]
}

delay (timeout)

Usage: Delay execution for specified timeout

Arguments Type Default Value Description
Timeout Number {timeout} Timeout of running commands

Coding:

{
  "name": "delay",
  "args": ["{timeout}"]
}

Example Route Scripts

1. Simple Page Navigation

{
  "name": "page",
  "args": ["HomePage"]
}

2. Conditional Logic

{
  "name": "if",
  "args": ["$logged==1"],
  "cmds": [
    {
      "name": "page",
      "args": ["dashboard"]
    }
  ]
}

3. Show a Toast Message

{
  "name": "toast",
  "args": ["Welcome to the app!"]
}

4. Buy and Use a Product

{
  "name": "buy-use",
  "args": ["PremiumSubscription","9.99"]
}

5. Multi-step When-Case Logic

{
  "name": "when",
  "cmds": [
    {
      "name": "case",
      "args": ["silver"],
      "cmds": [
        {"name": "toast", "args": ["Silver user access"]}
      ]
    },
    {
      "name": "case",
      "args": ["gold"],
      "cmds": [
        {"name": "toast", "args": ["Gold user access"]}
      ]
    },
    {
      "name": "else",
      "cmds": [
        {"name": "toast", "args": ["No access level"]}
      ]
    }
  ]
}