Version Checking

Walter Davis

26 Jul, 2012

Here’s a simple way to add version checking to your Actions. The included Action code example checks this server for the latest version you’ve registered here.

Using this system, you can add a button to your Actions that will let your users check to see if they are running the latest version of your Action.

Here’s all you need to add to your Action to make this happen:

function checkForUpdates(actionId,actionVersion){
    var url = 'http://actionsforge.com/actions/version/' + actionId + '/' + actionVersion;
    if(fwLaunchURL) {
        fwLaunchURL(url);
    }else{
        var osa=new FWOSAInterpreter; 
        osa.fwWrite('open location "' + url + '"'); 
        osa.fwCompile(); 
        osa.fwRun(); 
    }
}

//call it like this:
<action-button name="checkUpdates" title="Check for Updates" onClick="checkForUpdates('1','1.4')"/>

You will need to plug your Action’s id and version into the variables in the button code, and then that’s all that’s needed. If your users are using Freeway version 4 or below, they will need to enable AppleScript in their preferences, otherwise the Action will fail to work. Freeway 5 includes native access to URLs, so this fall-back is not needed there.

Your users can click the button at any time, and access the latest version information automatically. If they are up to date, the site will tell them so. If they have fallen behind, they will see a link to download the latest version, either on ActionsForge or your site.

  Register or log in to add tags

Register or log in to view or add comments.

FreewayTalk

Join the friendliest community on the Net at FreewayTalk. Ask and answer questions about Softpress Freeway, or just gather around the virtual water cooler!