Action

Insert Number

Posted by agiletortoise, Last update about 2 months ago

Convenience action for typing numbers on iOS.

This action opens a prompt with a single text input and the iOS decimal keyboard active to allow easier typing of numeric values. After accepting the input, the number is inserted in the current draft at the cursor position.

If you find this useful, you might also be interested in the Numbers+ action group, which provides a row of number keys to use in the Action Bar over the keyboard.

Steps

  • script

    // prompt for input using the numeric keyboard (iOS only)
    let p = new Prompt();
    p.title = "Enter Value"
    p.addTextField("n", "Number", "", {
    	"autocorrect": false,
    	"keyboard":  "decimalPad",
    	"wantsFocus": true
    });
    p.addButton("Insert");
    if(p.show() && p.buttonPressed == "Insert") {
    	let [st, len] = editor.getSelectedRange();
    	let s = p.fieldValues["n"];
    	editor.setSelectedText(s);
    	editor.setSelectedRange(st+s.length, 0);
    }

Options

  • After Success Default
    Notification None
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.