Index

Scripts Ausführen

Sie können in GarageSale eigene JavaScript-Actions erstellen, die auf Ihre Angebote oder Inventarartikel ausgeführt werden können, z.B. um zu überprüfen, ob bestimmte Angaben fehlen. Da diese Scripts direkt von GarageSale selber ausgeführt werden, haben sie eine deutlich bessere Performance als AppleScript.

Javascript-Actions können Sie im Script Editor-Fenster (in GarageSales Fenster-Menü) erstellen und auch ausführen.

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) {
      consoleLog(listing.title);
    }
}

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 fuction.

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:");
}


<< Bearbeitung ausgewählter Bestellungen Validierungs-Scripte beim Start von Angeboten ausführen >>