Page 1 of 1

Learning Scripting Basics

Posted: Wed Jun 30, 2021 10:02 pm
by YiMeng
USE SCRIPT BUILDER

SCRIPTING
This document includes the foundational concepts, guidelines, and steps necessary for creating a custom scripting language tailored to JRVSInputs.

JRVSInputs offers a simple scripting language that consists of using keywords. Scripts can be edited using any common text editor such as Notepad. Created scripts have a file extension of ".keyText" and is categorized as Script Objects.

Simply create a script file, edit it, and run!

SYNTAX

Syntax to scripts are simple. Each line is a line-command. Every line-command start out to be 1 of 3 types of line-command and they are key-command, string-command, and keyword-command. Each command may have parameters that follow. Commands are CASE-SENSITIVE. Most keywords are capitalized. Keyword-commands invokes various functions such as loops, repeats, delays, etc.

Only some keyword-commands allows/accept keyword-commands as parameters, thus making multiple keyword-commands on a single line possible.

DEFINITIONS:
  • KEY-command
    • Are lines in script that when split up by "+" and "," are valid Keyboard Key Names OR are all valid Keyboard Key Code Values for KEYCODE.
    • Keycode events specifies keys to be pressed at runtime
    • "+" specifies keys to be pressed at the same time, without release, similar to shortcuts.
    • "," specifies keys to be pressed in order, after previous key is released, similar to abbreviation.
  • KEYWORD-command
    • Are lines in script that starts with the set keyword. All keywords are CASE-SENSITIVE.
    • Keywords are the most unique out of the 3 types of line-commands. Different keywords accepts different parameters.
    • For a list of keyword-commands and their documentations, visit SCRIPT KEYWORDS
  • STRING-command
    • Are lines in script that does not meet the requirement to abe a key-command or keyword-command.
    • String events are to be typed, as is, into active text field on any application in focus.
  • LINE-command
    • A line-command is exactly what it sounds like. Every line of the script is a line-command.
    • However, scripts supports the use of "^" as line breaker character. Thus, a line-command can also occupy multiple lines.
    • Further more, as explained above in the syntax section, some keyword-commands are able to accept keyword-commands as parameters, by using the "|" symbol. Thus, a line-command can also include multiple keyword-commands.
      • For example: "REPEATS 10 DISPMSG HelloWorld! | delay 2"
        • This can be read as 2 keyword-commands on a single line using the REPEATS keyword-command, which is one line-command.
        • This command will display "HelloWorld!" then waits for 2 seconds and repeat a total of 10 times.

FUNCTIONS
  • Calling script functions are similar to setting script variables.
    • Retrieving variable values consist of variable name within opening and closing "%" symbol without spaces in between.
    • Functions with parameters follows similar syntax, but differenciates from the function name seperated by "&" symbol. Example: %functionName&param1&param2&...%

    The number of params for a function depends on the defined function. For a list of available functions, visit here.

FIRST-SCRIPT
  • Follow step-by-step instructions to create a new script.
    • In the empty notepad, paste the following
      • win+r
        STRING notepad.exe
        enter
        delay .5
        STRING Hello World!
    • Save it. Continue follow steps from creating a new script.
    • Run it.
    • This will perform the key combination to bring up a blank notepad file and type "Hello World!"

UPDATE-SCRIPT
  • The process of making changes to scripts has been made extremely easy and no more difficult than opening notepad and save. This automatically updates any exported batch file for this script. It makes the implementation, iteration and testing fast, fun and rewarding!

MORE EXAMPLES