Quantcast
Channel: Objective Development Forums
Viewing all articles
Browse latest Browse all 4524

Wolfram Alpha Live Search

$
0
0
Hi LB6 beta testers!

Can anybody fix this javascript to get live search going for Wolfram Alpha?

function run(arguments) {
    var search = arguments[0];
    if (search == undefined || search.length == 0) {
        return [];
    }

    var result = HTTP.getJSON('http://www.wolframalpha.com/input/autocomplete.jsp?qr=' + encodeURIComponent(search), 3);

    if (result == undefined) {
        LaunchBar.log('HTTP.getJSON() returned undefined');
        return [];
    }
    if (result.error != undefined) {
        LaunchBar.log('Error in HTTP request: ' + result.error);
        return [];
    }

    try {
        var suggestions = [];
        for (var suggestion in result.data) {
            suggestions.push({
                             'title' : suggestion,
                             'icon' : 'walpha.png'
                             });
        }
        return suggestions;
    } catch (exception) {
        LaunchBar.log('Exception while parsing result: ' + exception);
        return [];
    }
}


This is what I get:
Image
I have no Javascript knowledge. I just tried to modify the duden lbaction. But this is not Applescript ;)

So smart people please help!

Viewing all articles
Browse latest Browse all 4524

Trending Articles