How to launch applications from the download manager

The following developer blog entry describes how to open certain file types in predefined applications over the download manager. This developer blog entry works only with SiteKiosk Online for Windows. 

We start by creating a project using the browser template.

In the Webpage element settings, under Browser UI, select the Downloads checkbox and save the setting.

In the project, press the Settings button and in the Downloads section, select the Allow Downloads check box.

Go to Settings - Client - Advanced and press the Add settings button.

Enter the path downloads.downloadFileActions which offers you following default value:

 

[
    {
        "extension": "pdf",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "txt",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "png",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "gif",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "jpg",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "jpeg",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "exe",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    },
    {
        "extension": "zip",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    },
    {
        "extension": "7z",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    }
]

Copy the complete value section and enter the content to texteditor application.

Now you have two options to configure the file action: OpenWithCustomApplication to open Files with a defined extension over a custom application or OpenWithWindowsStandardApplication, to launch the standard application of the system. In the Following example we change the entry for the extension pdf from: 

 

{
        "extension": "pdf",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },

 to

{
        "extension": "pdf",
        "customApplicationPath": "C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe",
        "actionType": "OpenWithCustomApplication",
        "autoExecute": false
    },

   

So with pressing the Open Button on a downloaded PDF file in the download manager the PDF will be opened with the Acrobat Reader.

In the second example, we add the following entry at the end of the array separated by a comma to the previous entry:

 

{

        "extension": "docx",
        "customApplicationPath": "",
        "actionType": "OpenWithWindowsStandardApplication",
        "autoExecute": false

    }

So with pressing the Open Button on a downloaded docx file in the download manager the file will be opened with the standard application Word. With these modification the value looks like this.

Example:

Path: downloads.downloadFileActions

Value:

 

[
    {

        "extension": "pdf",
        "customApplicationPath": "C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe",
        "actionType": "OpenWithCustomApplication",
        "autoExecute": false
    },
    {
        "extension": "txt",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {

        "extension": "png",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {

        "extension": "gif",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "jpg",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {

        "extension": "jpeg",
        "customApplicationPath": "",
        "actionType": "openInSiteKiosk",
        "autoExecute": true
    },
    {
        "extension": "exe",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    },
    {
        "extension": "zip",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    },
    {
        "extension": "7z",
        "customApplicationPath": "",
        "actionType": "downloadOnly",
        "autoExecute": false
    },
    {
        "extension": "docx",
        "customApplicationPath": "",
        "actionType": "OpenWithWindowsStandardApplication",
        "autoExecute": false
    }
]

Copy and paste the whole value to the advance setting dialogue and save the advanced setting.

Publish the project to the client on which Adobe Acrobat Reader is installed and Word is set the default app to open docx.

To test the file actions download a Word and a PDF file and open them over the download manager.

How to configure buttons to start external applications over the start menu and taskbar

This devblog entry describes how to generate buttons for launching external applications in the SiteKiosk Online Client for Windows via the Start menu or the taskbar. This is especially useful for full-screen browser projects where you want to launch external applications that are controlled by SiteKiosk.

The following entry works with SiteKiosk Online Client for Windows version 1.1.2539.6604 or higher (https://sitekiosk.online/). Note that it can only be used for windows clients. In this example Notepad is starting over customized buttons in the start menu and taskbar.

We start with generating a project with the template browser. 

Go to Settings - Client - Advanced and press the Add settings button

Enter the Path applications and following value:

[

    {

        "name": "notepad",

        "startParameters": {

            "kind": "executable",

            "executable": {

                "filePath": "C:\\WINDOWS\\system32\\notepad.exe",

                "arguments": null,

                "startAsChildProcess": false

            }

        }

    }

]

 

Save the setting.

To generate a taskbar button, press the Add settings button.

Enter the path ui.taskbar.taskbarEntries and add following value:

[

    {

        "name": "logoutSiteKiosk"

    },

    {

        "name": "startApplication",

        "startApplication": {

            "name": "notepad"

        }

    }

]

 

Save the setting.

To activate the start menu, press the Add settings button.

Enter the path ui.taskbar.showStartMenu and check the checkbox.

 

To generate a start menu entry, press the Add settings button.

Enter the path ui.taskbar.startMenuEntries and following value:

[

    {

        "name": "logoutSiteKiosk"

    },

    {

        "name": "startApplication",

        "startApplication": {

            "name": "notepad"

        }

    }

]

 

Save the setting and close the Clients setting dialog with pressing the button save.

Publish your project to test the settings.

Starting an External Application from a SiteCaster Project

In case you want to start an external application from your SiteCaster project, you need to switch to the SiteCaster expert mode.

Open the project in the SiteCaster editor. In the URL address field of your browser you must add &expert at the end of the URL and then press Enter to reload the project.

After activation of the expert mode you see the pen button in the menu bar. Now create an image (note that this will work with most other elements as well) on your project page, select the image and press the expert mode pen button. You can resize the inspector on the right via drag and drop to access the following lines easier.

Go to additionalLink and select JSON object in the dropdown menu. Then replace “image” with “script” in the text field.

Next go to linkActive to select Boolean from the dropdown menu and check the checkbox.

Finally go to scriptSource, select String and add the following line for SiteKiosk Windows with the path to the desired application
siteKiosk.system.windows.skLegacy.externalApps.run("PathToYourApplication", false);
to the scriptSource text field, e.g.
siteKiosk.system.windows.skLegacy.externalApps.run("C:\\Program Files\\Notepad++\\notepad++.exe", false);

Please note that from SiteCaster 1.5 the command is much shorter: siteKiosk.system.run("C:\\Program Files\\Notepad++\\notepad++.exe", false);
In both cases the second parameter of the run function is a boolean value that needs to be false if an existing instance of the application should be focused instead of opening a new one and true if an additional instance should be opened.

Should the scriptSource property not be available, scroll down to Add property and add it there by filling out the fields and hitting the plus button, e.g.:

It is strongly recommended to also add your external application in the SiteKiosk configuration under Applications so that SiteKiosk can close the application when the screensaver is activated.

Once the project is published to the client, a click on the element will open the application.

The above is the notation to make it work under SiteKiosk Windows. For SiteKiosk Android it is slightly different. In order to start the application you need to know its guid name, e.g. com.android.calculator2. Either you know this information for the app you would like to start or you can use the SiteKiosk logs to find this information. To do so, just add the desired app in the SiteKiosk configuration under Application -> Android App or Application -> Multiple Applications. Next start SiteKiosk and make sure the app has started at least once. Now close SiteKiosk and open the SiteKiosk log file in the ..\SiteKiosk\Logs folder. Look for an entry with the text System app launched, e.g. System app launched: com.android.calculator2. In our example the guid name we are looking for is com.android.calculator2. This information is required to start that specific app from SiteCaster.

With this information gathered we can compose the line that needs to be added as the scriptSource in SiteCaster to look like this:
__siteKiosk.system.apps.getByGuid("com.android.calculator2").launch("", "systemApp");

Please note that you need to add the app in the SiteKiosk Android configuration under Security -> Allow assigned apps, if it is not addd there it will be blocked.