# Scripting Aptana [edit]

Aptana allows you to script a large part of its features. Here are some common shortcuts to popular things you may wish to do.

## Insert text at the cursor position

    var editor = editors.activeEditor;
    var offset = editor.selectionRange.startingOffset;
    editor.applyEdit(offset, 0, text)

## Replace selected text

    var editor = editors.activeEditor;
    var offset = editor.selectionRange.startingOffset;
    var deleteLength = editor.selectionRange.endingOffset - editor.selectionRange.startingOffset;
    editor.applyEdit(offset, deleteLength, text);

## Ask for a value

    prompt(prompt-string, [default-value])

Retrieved from "http://aptana.com/docs/index.php/Scripting_Aptana"

Category: AptanaHelp