Running Scripts

GarageSale lets you define custom JavaScript actions to process listings and inventory items in your library. Since these scripts are executed within GarageSale itself, they offer far better performance than AppleScript.

You can create and run scripts from the Show Script Editor Window command in the Windows menu.

Script Editor

Accessing all listings

You can access all listings in your GarageSale library through the allListings variable.

function run() {
    consoleLog("your library contains " + allListings.length + " listings);

Accessing selected listings

You can access the currently selected listings in GarageSale’s outline view through the selectedListings variable.

function run() {
    for (listing of selectedListings) {

Displaying alerts to the user

The displayDialog() function presents the user with dialog with a custom message and one or two buttons. The title of the clicked button is the result of the function.

function run() {
    result = displayDialog("Do you want to continue?", "Continue", "Cancel");
    if (result == "Continue") {
        displayDialog("You did indeed continue.", "OK", "");
    } else {
        displayDialog("You canceled.", "OK", "");

JavaScript - DisplayDialog()

Letting the user select listings

The askForListings()function presents the user with a list of listings. The user can select multiple listings and approve the selection using the default button (first button), or cancel the selection using the alternate button (second button), in which case no listings are returned.

This function will block the execution of your script until the user has closed the panel by clicking one of the buttons.

function run() {
    listings = askForListings(selectedListings, "Please select the listing:", "OK", "Cancel");
    for (listing of listings) {
        consoleLog("listing title is " + listing.title);

JavaScript - AskForListings()

Showing listings to the user

The showListings function will present a list of listings to the user.

This function will not block your script from executing. It can be invoked multiple times, and the windows will stay open after your script has finished executing.

If the user clicks on a listing in the list, it will get selected in GarageSale’s main window.

function run() {
    showListings(selectedListings, "These listings need investigation:");

<< Modifying Selected Orders Validating scripts when launching listings >>