Skip to content

Built in Commands

Zplutor edited this page Aug 8, 2023 · 9 revisions

Overview

There are several built-in commands in RunAnywhere to meet common needs in daily works.

Meta Commands

Meta commands are used to control RunAnywhere itself. All meta commands start with ! character.

!about

Show about window.

!option

Show option window.

!reload

Reload user-defined commands from bundle files in the bundle depot directory.

Tool Commands

b64

Base64 encode or decode specified text.

Usage

b64 <text> [/e] [/d] [/u8] [/u16] [/h]

If there are space characters in text, enclose it in double quotation marks ". Or use text block(press ALT+T to insert) to contain arbitrary text.

The command detects if text is a Base64-encoded string, if so, decoding mode is used; otherwise encoding mode is used. You can also use /e or /d switches to indicate using encoding mode or decoding mode explicitly.

/u8, /u16 switches indicate that which encoding will be used to encode text. They represent UTF-8 and UTF-16 respectively. UTF-8 encoding is default if none of them is specified.

/h indicates displaying decoded content in hex format rather than in text.

Example

Encode text: b64 "This is a text."

Decode text and display result in hex format: b64 VGhpcyBpcyBhIHRleHQu /h

date

Converts between human readable date time string and UNIX timestamp.

Usage

date [timestamp] [adjustment] [/e]

timestamp is a UNIX timestamp like 1664430057. If it is omitted, current date time will be used.

adjustment is used to adjust the time by a specified amount of unit. An adjustment starts with a + or - character, and then an integer, followed by an unit identifier, such as +10s, -7d. Available unit identifiers are:

  • s, seconds
  • min, minutes
  • h, hours
  • d, days
  • w, weeks
  • mon, months
  • y, years

If unit identifier is omitted, seconds will be used. There can be multiple adjustments as arguments.

/e switch indicates that the result wil be displayed as a UNIX timestamp rather than a human readable string.

Example

Dispaly current date time: date

Display the date time 180 days ago: date -180d

Convert current date time to a UNIX timestamp: date /e

Convert a UNIX timestamp to human readable string: date 1664430057

err

Show error message for specified system error code.

Usage

err <code>

code is a value returned by GetLastError() function, or a HRESULT returned by some COM interfaces. Note that not all COM errors are supported.

code can be a signed/unsigned decimal, or a hexadecimal which begins with x or 0x. It will be converted to a 32bit unsigned integer to find the corresponding error message.

Example

Show system error code: err 5

Show COM error code: err 0x80070057

Show COM error code with signed decimal: err -2147024888

hex

Display the active file content in hex and ASCII format.

Usage

hex [position] [length]

position specifies the begin position of content to display. The default is 0 if it is omitted.

length specifies the length of content to display. It is prefixed with letter l or L. The default is 128 if it is omitted. The max supported length is 4096. Use two l or L letters to specify the max length, for example ll.

Both position and length can be in decimal or hexadecimal format. Use x or 0x as prefix for hexadecimal.

Example

Display 32 bytes of content started from 8: hex 8 l32

low

Transform all characters in specified text to lowercase.

Usage

low <text>

If there are space characters in text, enclose it in double quotation marks ". Or use text block (press ALT+T to insert) to contain arbitrary text.

md5

Calculate MD5 hash of the active file or a specified text.

Usage

md5 [text] [/u8] [/u16] [/c]

text is a string to be calculated. If there are space characters in text, enclose it in double quotation marks ". Or use text block (press ALT+T to insert) to contain arbitrary text. If text is omitted, the active file will be calculated instead.

/u8 , /u16 switches indicate that which encoding will be used to calculate text. They represent UTF-8 and UTF-16 respectively. UTF-8 encoding is default if none of them is specified.

/c switch indicates that to use upper-case to display the result.

Example

Calculate MD5 of specified text in UTF-16 encoding: md5 "this is a string" /u16

Calculate MD5 of the active file, displaying the result in upper-case: md5 /c

rgb

Display the color specified with RGB value.

Usage

rgb <color> [$alpha] [/a] [/d] [/f] [/x]

color is a RGB value, you can use one of the two formats to specify a color value.

Comma-separated format: R,G,B or R,G,B,A. Components can be following forms:

  • Integers, range from 0 to 255.
  • Floats, range from 0 to 1.0.
  • Hex, range from 0x0 to 0xFF.

All components must be the same form.

Hexadecimal format: #RRGGBB or #AARRGGBB.

If A or AA is omitted, the opacity is 100%.

$alpha specifies an additional alpha value to the color. alpha can be integer, float or hex, same as comma-separated format discussed above.

/a switch indicates that to reserve the opacity. If the color specified by color which opacity is not 100%, it will be transformed to another color which opacity is 100% by default. For example, color #CC000000 will be transformed to #FF333333 and displayed in result. If you want to reserve its original opacity, you can specify /a switch. However, the appearance of color will not changed, because its opacity is combined with the white background.

/d , /f , /x switches indicate that to display the color’s RGB value in comma-separated format, and to display each component in integer, float, or hex form respectively. If none of them is specified, hexadecimal format will be used as default.

Example

Display the semitransparent color in comma-separated format: rgb 100,100,100 $0.5

Display the color in hexadecimal format, and convert it to comma-separated format: rgb #CCA7B8D9 /d

up

Transform all characters in specified text to uppercase.

Usage

up <text>

If there are space characters in text, enclose it in double quotation marks ". Or use text block (press ALT+T to insert) to contain arbitrary text.

Clone this wiki locally