PROVISIO DevBlog

The Powerful Run Executable Job Action Type of SiteRemote

An often overlooked action type of the SiteRemote job system (in your SiteRemote team choose SiteKiosk from the menu and then select the job tab) is one called Run Executable. It is a more general action type than most of the others but that is what makes it so powerful. What it allows you to do is to basically run any executable including the use of parameters.  

 

You can run Windows Powershell, batch files, (silent) installers, Windows system tools and so on. This allows you to administrate your SiteKiosk Windows machines in almost every possible way in addition to the SiteKiosk administration and monitoring the SiteRemote GUI already helps you with.

It is even possible to update SiteKiosk remotely with the help of the Run Executable job action type. Please contact our support for more information, because the exact method varies based on the SiteKiosk version in use.

This job action type runs on the client invisible with administrative privileges in the context of the Local System user or visible with the rights of the user that is logged in at the moment the job is executed.

If the executable you run provides a return value you can use that to show whether the job was successful or not on the SiteRemote job page. Not using this option will show the job as successful if starting the executable did not return an error.

A simple example that starts Notepad with the SiteKiosk license text would be this command line:

"c:\windows\notepad.exe" "c:\program files (x86)\SiteKiosk\license-en.txt"

If you then choose the option Visible execution with user rights, the job will start Notepad with the license text file on the SiteKiosk Windows machine, once the job has been assigned and ececuted on a client.

Please note that past DevBlog posts have described how to access 64-Bit system folders and registry paths (https://devblog.provisio.com/post/2015/11/03/Accessing-64-Bit-System-Folders-and-Registry-from-the-SiteRemote-Job-System.aspx) or how to unzip zip archives uploaded with a SiteRemote job step to a specific destination folder (https://devblog.provisio.com/post/2016/02/22/Distributing-the-SiteKiosk-Windows-Start-Screen-with-SiteRemote.aspx) all with the help of the Run Executable job action type.

Keep Additional Windows Visible when Using SiteKiosk Windows in Fullscreen Mode Without a Taskbar

This example script is intended to be used when SiteKiosk Windows runs in fullscreen mode without a taskbar. When additional windows are allowed, either browser or application windows, users can intentionally or unintentionally hit the minimize button. Without a taskbar the window is then hidden to the user.

This script will scan for minimized windows and restore them. It can be used with the Chrome and Internet Explorer browser engines of SiteKiosk Windows. It works for browser windows and windows of other applications.

Please note that you need to enable the option to 'Keep the SiteKiosk main window in the background (not TopMost)' when using the Internet Explorer browser engine of SiteKiosk Windows. The option can be found under Start Page & Browser -> Internet Explorer -> Advanced. This option is not required when using the Chrome browser engine of SiteKiosk Windows as it behaves like this by default.

The script looks like this:

//If using the Internet Explorer browser engine of SiteKiosk, please activate the option 
//Keep the SiteKiosk main window in the background (not TopMost)
//when using this script. The option can be found in the SiteKiosk configuration under
//Start Page & Browser -> Internet Explorer -> Advanced.
//The Chrome browser engine of SiteKiosk behaves like this by default.

SiteKiosk.Scheduler.AddPeriodicEvent(1000, windowWatchdog);

function windowWatchdog(){
	SKWindows = SiteKiosk.WindowList.Windows;
	for (var i = 1; i <= SKWindows.Count; ++i){
		if (SKWindows.Item(i).WindowType !== 1 && SiteKiosk.WindowList.IsMinimized(SKWindows.Item(i).Handle)){
			SiteKiosk.WindowList.Restore(SKWindows.Item(i).Handle);
		}
	}
}

It uses the Scheduler object of the SiteKiosk Object Model to schedule a periodic event that calls a function that checks the status of all windows every second.

The Windows collection of the WindowList object includes all existing windows. The script steps through all of them and looks for windows, that are not the main window of SiteKiosk, which would have a WindowType of 1, and are minimized.

It will then use the Restore method to make the window visible again.

Using HTML Tags to Customize Text Fields of the SiteKiosk Windows Start Screen

When using the Start Screen of SiteKiosk Windows, you can use HTML tags in text fields to customize the appearance. This allows you to create individual projects beyond what is already possible with the standard options of the Start Screen Editor.

To give an example of the possibilities, you can open the SiteKiosk Configuration tool, go to Start Page & Browser and select the Start Screen. From there, click on Customize, then on Start Screen Editor and open the editor. For this example select Template 3, which is empty by default.

Let's add a new element of the Web link type. Note that you can do this with any element that has text fields, this is usually the caption for the element.

After the Web link element has been added, edit it by opening the properties. Go to Caption and use the Text property at the top of the page. Note that on this page you can already edit the font, size and color of the complete text. But this example wants to show that you can override all of this with HTML tags. You can give each character of the default text, which is Web, a different look and even a function.

In this example change the default Text size to 50 and write this into the Text field:

<b>W</b><span style="color: yellow;font-family:cursive;font-size:22px;">e</span><span onclick="alert('Show this alert when clicking on the b character!');" style="color:red;font-size:34px;">b</span>

This will make the W bold while it keeps the defined general size, font type and color, it will make the e yellow while giving it a size of 22 pixels and assign the cursive font to it, the b will show in red with a size of 34 pixels and display an alert window when being clicked. This just demonstrates a few of the options you have, because the text field allows HTML tags to be used.

When you start SiteKiosk, the result will look like this, with an open alert window after clicking on the b character:

Starting the SiteKiosk File Manager from a Custom Button in SiteKiosk Windows Chrome Browser

As a default option the SiteKiosk file manager is only available with IE-based skins. There are different ways to also start the file manager when using the Chrome browser of SiteKiosk Windows. How to start the SiteKiosk file manager when using the Chrome Browser and the Start Screen has been described here. Now we want to take a look at how to start the file manager using the custom button option.

First we need to create a local JavaScript file that takes care of the task of opening the File Manager. The code for that file can look like this:

function openFileManager(){
 //Defines the available Window styles for the File Manager window
 var WS_OVERLAPPED = 0x00000000;
 var WS_MAXIMIZEBOX = 0x00010000;
 var WS_MINIMIZEBOX = 0x00020000;
 var WS_THICKFRAME = 0x00040000;
 var WS_SYSMENU = 0x00080000;
 var WS_BORDER = 0x00800000;
 var WS_CAPTION = 0x00C00000;
 var WS_MAXIMIZE = 0x01000000;
 var WS_MINIMIZE = 0x20000000;
 var WS_POPUP = 0x80000000;
 var WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
 var WS_EX_TOOLWINDOW = 0x00000080;
             
  //Creates the File Manager window and assigns its settings
  var mediabox = SiteKiosk.SiteKioskUI.CreateHTMLDialog();
  mediabox.URL = SiteKiosk.SiteKioskDirectory + "skins\\public\\Media\\FileManager\\Selector.html";
  mediabox.Styles = 13565952;
  mediabox.Icon = SiteKiosk.SiteKioskDirectory + "skins\\public\\Media\\FileManager\\Img\\Icons\\fms_ico.ico";
  mediabox.Width = 1024;
  mediabox.Height = 700;
  mediabox.ExStyles = 0;//
  mediabox.Border = true;
  mediabox.Type = "FileManagerDlg";
  mediabox.TopMostWindow = false;
  mediabox.CloseOnInput = false;
  mediabox.Parent = SiteKiosk.WindowList.MainWindow.SiteKioskWindow.Window;
  mediabox.ShowDialog();
			
}

Just copy and paste the code to an editor and save it for example as "OpenFileManager.js" at "…\SiteKiosk\Html".
Next it's time to open the SiteKiosk configuration and adding this script file at "Start Page & Browser-->Advanced-->On startup of SiteKiosk execute the following script file".

Then create an HTML file (e.g. OpenFileManager.html) with the following content and save it in the folder "...\SiteKiosk\Html":

<html>
<head>
<script>
    (new Function(_siteKiosk.getSiteKioskObjectModelCode()))();
    _siteKiosk.objectModel.callHostFunction("system.windows.skLegacy.executeScript", "SiteKiosk.ScriptDispatch.openFileManager();");            
     window.close();
</script>
</head>       
<body>
    <!-- Body is empty as this window is only used to open the File Manager //-->
</body>
</html>

The function OpenFileManagerExt is "Using the Classic SiteKiosk Object Model in SiteKiosk Windows Chrome Browser" in combination with the "ScriptDispatch Object" from classic SiteKiosk Object Model to call the external script function "openFileManager".

Now add a button in the Chrome Browser Skin under "Start Page & Browser-->Customize-->Browser Toolbar-->Individual Buttons-->Set individual weblink or program" which calls the above HTML file.

General Note:
Which directories are displayed in the File Manager (download folder, etc.) must be specified beforehand under "Files & Downloads", while you have selected the Metro IE Skin under "Start Page & Browser".
The path for the download folder should match the download folder in the Chrome Browser skin.
Since the download folder matches with the default settings "C:\Users\Public\Documents\SiteKiosk" you normally only need to activate the File Manager and Downloads.

Finally it should look like this when the File Manager is opened:

Starting Password Protected Applications from the Start Screen of SiteKiosk Windows

SiteKiosk Windows allows you to password protect the starting of external applications. For technical reasons this feature is not available for the Application link element of the Start Screen, which is the element you would normally use to add an application to the Start Screen. By using the HTML Widget element instead, the password protection for applications can be used with the Start Screen. Here is how.

Open the SiteKiosk configuration and go to Applications. Add the external applications you need to the list. Note that you can use the arrows on the left side of the list to move applications up and down to rearrange the order.

 

Use the settings dialog for an application to make the start of it password protected.

 

Next go to Start Page & Browser in the configuration of SiteKiosk and select the Start Screen. Click on Customize, select Start Screen Editor and use the Open Editor button. Choose the template you want to use and add an HTML Widget element. Copy the following lines:

<script type="text/javascript">
    function StartPWprotectedApp() {
        parent._siteKiosk.objectModel.callHostFunction("system.windows.skLegacy.executeScript", "SiteKiosk.ExternalApps.Item(1).Run(true);");
    }
</script>
<div style="background-color:FF235A;height:100%;padding:10px;font-family:Arial;cursor:pointer;" onclick="StartPWprotectedApp();">
    <div style="height:100%;width:100%;font-size:30px;text-align:center;margin-top:42%;">Start Password<br/>Protected App</div>
</div>

Paste the code into the HTML code box in the properties dialog of the HTML Widget.

 

You can use the div tag to style the element to your liking. The line

parent._siteKiosk.objectModel.callHostFunction("system.windows.skLegacy.executeScript", "SiteKiosk.ExternalApps.Item(1).Run(true);");

is what calls the actual application. Note the number 1 as the argument for the Item method (more information can also be found here and here). This calls the actual application based on the position in the application list of the SiteKiosk configuration. 1 calls the first application in the list, 2 calls the second application and so on. Add as many HTML Widget elements as you need.

The final result based on the example code above will look like this in SiteKiosk:

Extend the SiteKiosk Browser workspace to multiple screens (Combine several screens to one screen)

To extend the workspace of the SiteKiosk Windows browser to multiple screens that are configured as separate screens in Windows with "Extend these screens", proceed as follows:

 

A. In the SiteKiosk configuration under "-->Start Page & Browser-->Secondary Monitor", deactivate the "Restrict mouse pointer to first monitor browser area" option. (The option "Activate secondary monitor" must remain deactivated!).

B. Now you have to allow the display of new browser windows on the second monitor.
For this open the SiteKiosk configuration file you created (e.g. ...\SiteKiosk\Config\YourConfig.skcfg) with an editor (e.g. Notepad) and search for the following line:

<windowmanager>

Add the following content to the next line:

<disallow-window-clipping>true</disallow-window-clipping>

Like this:

<windowmanager> 
   <disallow-window-clipping>true</disallow-window-clipping>  
   <show-block-msg>true</show-block-msg> 
   <use-secure-user>false</use-secure-user>
</windowmanager>

For more information see "20. Remove restriction to limit windows to the SiteKiosk display area":
https://www.provisio.com/helpconsole/SiteKiosk%20Help/en-US/default.htm?manuell_editierbare_optionen.htm

C. The next step is to adjust the "workarea" of SiteKiosk to the resolution of all your monitors combined. To do this, use the setting described at "5. Restrict SiteKiosk to a Portion of the Screen":
https://www.provisio.com/helpconsole/SiteKiosk%20Help/en-US/default.htm?manuell_editierbare_optionen.htm

Example:
Two monitors side by side with a resolution of 2560x1440 px each give a workarea of 5120x1440px on both monitors.

The corresponding "workarea" adjustment looks like this:

<workarea enabled="true" absolute-coordinates="true">
      <capture-mouse>false</capture-mouse>
      <left>0</left>
      <top>0</top>
      <right>5120</right>
      <bottom>1440</bottom>
</workarea>

After saving the changes and starting SiteKiosk, the browser extends across both monitors.

 

NOTE:
Due to Windows User Account Control (UAC) restrictions, you may need to start the text editor as an administrator (right-click-->Run as administrator) to save the changes in the Programs directory.



 

 

Disabling Flash Support for SiteKiosk Windows

Because of security concerns regarding the use of Flash a growing number of users wants to disable it. This can be achieved differently based on the browser engine that is being used in SiteKiosk Windows.

For the Chrome engine of SiteKiosk Flash support is already disabled by default. It can be controlled in the configuration of SiteKiosk under  Start Page & Browser -> Chrome Browser -> Customize -> Settings -> Flash support.

The Internet Explorer engine is based on the WebBrowser Control provided by Microsoft and uses the same Flash settings as the Internet Explorer installed on the system. Since Windows 8 Flash is part of the Windows operating system and cannot be uninstalled. But it can be disabled. This is done by compatibility flags in the Windows registry.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}]
"Compatibility Flags"=dword:00000400
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\ActiveX Compatibility\{D27CDB6E-AE6D-11CF-96B8-444553540000}]
"Compatibility Flags"=dword:00000400

You can copy the above into an editor like Notepad and save it as a .reg file, e.g. as turn_flash_off.reg. On the SiteKiosk machine you want to disable Flash just run the .reg file under an administrator account by double-clicking it and follow the on-screen instructions.

Here is a before and after comparison in SiteKiosk using the https://get.adobe.com/flashplayer/about/ information page of Adobe.

 

 

Note that you can also use SiteRemote to distribute the registry settings to your SiteKiosk Windows machines. Please have a look here (http://devblog.provisio.com/post/2014/08/14/Using-SiteRemote-to-Change-Windows-Registry-Settings.aspx) and here (http://devblog.provisio.com/post/2015/11/03/Accessing-64-Bit-System-Folders-and-Registry-from-the-SiteRemote-Job-System.aspx) for more information.

 

 

 

Starting the SiteKiosk File Manager from the Start Screen with Chrome Browser Skin

This time we are going to have a look at how to start the SiteKiosk File Manager directly from the SiteKiosk Start Screen. But in opposite to the older article here we now also make it work when using the Start Screen with Chrome Browser skin.

First we need to create a local JavaScript file that takes care of the task of opening the File Manager. The code for that file can look like this:

 

function openFileManager(){
 //Defines the available Window styles for the File Manager window
 var WS_OVERLAPPED = 0x00000000;
 var WS_MAXIMIZEBOX = 0x00010000;
 var WS_MINIMIZEBOX = 0x00020000;
 var WS_THICKFRAME = 0x00040000;
 var WS_SYSMENU = 0x00080000;
 var WS_BORDER = 0x00800000;
 var WS_CAPTION = 0x00C00000;
 var WS_MAXIMIZE = 0x01000000;
 var WS_MINIMIZE = 0x20000000;
 var WS_POPUP = 0x80000000;
 var WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
 var WS_EX_TOOLWINDOW = 0x00000080;
             
  //Creates the File Manager window and assigns its settings
  var mediabox = SiteKiosk.SiteKioskUI.CreateHTMLDialog();
  mediabox.URL = SiteKiosk.SiteKioskDirectory + "skins\\public\\Media\\FileManager\\Selector.html";
  mediabox.Styles = 13565952;
  mediabox.Icon = SiteKiosk.SiteKioskDirectory + "skins\\public\\Media\\FileManager\\Img\\Icons\\fms_ico.ico";
  mediabox.Width = 1024;
  mediabox.Height = 700;
  mediabox.ExStyles = 0;//
  mediabox.Border = true;
  mediabox.Type = "FileManagerDlg";
  mediabox.TopMostWindow = false;
  mediabox.CloseOnInput = false;
  mediabox.Parent = SiteKiosk.WindowList.MainWindow.SiteKioskWindow.Window;
  mediabox.ShowDialog();
			
}

Just copy and paste the code to an editor and save it as for example as "OpenFileManager.js" at "…\SiteKiosk\Html".
Next it's time to open the SiteKiosk configuration and adding this script file at "Start Page & Browser-->Advanced-->On startup of SiteKiosk execute the following script file".

Under "Start Page & Browser" select the Start Screen. Click on "Customize" and open the Start Screen editor. Select one of the three templates and create a new HTML Widget link element. Edit the element and add the following code that calls the external script function openFileManager:

 

<script>
    (new Function(_siteKiosk.getSiteKioskObjectModelCode()))();
    function openFileManagerExt() {
		_siteKiosk.objectModel.callHostFunction("system.windows.skLegacy.executeScript", "SiteKiosk.ScriptDispatch.openFileManager();");			
    }
</script>
<div style="background-color:2DA7FF;height:100%;padding:10px;font-family:Arial;cursor:pointer;" onclick="openFileManagerExt();">
    <div style="height:100%;width:100%;font-size:30px;text-align:center;margin-top:3%;">Open<br/>File Manager</div>
</div>

 

The function OpenFileManagerExt is "Using the Classic SiteKiosk Object Model in SiteKiosk Windows Chrome Browser" in combination with the "ScriptDispatch Object" from Classic Object Model to call the external script function "openFileManager".

 

In the <div></div> part you can use HTML code of your choice to change the element to your liking (text, color, etc.).

General Note:
Which directories are displayed in the File Manager (download folder, etc.) must be specified beforehand under "-->Files & Downloads", while you have selected the Metro IE Skin under "-->Start Page & Browser".
The path for the download folder should match the download folder in the Chrome Browser skin.
Since the download folder matches with the default settings "C:\Users\Public\Documents\SiteKiosk", you normally only need to activate the File Manager and Downloads.

At the end it should look like this when the File Manager is opened:

Manipulating the DOM within the SiteKiosk Windows Chrome Browser

Editing the DOM of a website displayed in the Chrome Browser of SiteKiosk Windows (please have a look here for the Internet Explorer browser of SiteKiosk) can be easily achieved by adding the DOM manipulation script to the file C:\Program Files (x86)\SiteKiosk\SiteKioskNG\assets\customScriptExtension.js.

The file is empty be default and will be executed for every webpage displayed in the Chrome Browser of SiteKiosk Windows. You should therefore make sure to add script code to identify the page you want to manipulate.

The DOM manipulation does not require SiteKiosk specific script code. Plain Javascript can be used.

The following example code edits the main search page of Google to include SiteKiosk as the search term and to change the text of the Search button to "Search for SiteKiosk". Note that the code already does a basic check, if the website is a Google website before it executes the rest of the Javascript code.

if (document.URL.indexOf("https://www.google.") !== -1) {
	document.addEventListener('DOMContentLoaded', documentLoadedFunc);
}

function documentLoadedFunc(e) {
	document.getElementsByName('q').item(0).value = "SiteKiosk";
	document.getElementsByName('btnK').item(1).value = "Search for SiteKiosk";
}

Just copy and paste the above example script to the file C:\Program Files (x86)\SiteKiosk\SiteKioskNG\assets\customScriptExtension.js and then start SiteKiosk with a basic configuration file. Open google.com. The result of the example DOM manipulation will look like this:

Note that when using the above example you should make sure to take care of local laws, ownership rights, copyright etc. Also note that the above example only works as long as Google does not change the code of their page.

How to Rearrange the Layout of the SiteKiosk Chrome Browser

Here is a quick way to completely move around the main parts of the SiteKiosk Chrome browser. This for example can be used to show the tool bar not at the top but at the bottom.

Open the file C:\Users\Public\SiteKiosk\data\content\local\files\projects\d97aa96b962543fcb39625a3f8e8d8fb\000000000000000000000000\content.json with an editor, e.g. Notepad. And look for the lines

"templates": {
	"main": {

A few lines below you will see the start of the elements segment, that by default lists the element with the name topContainer first.

"elements": [
	{
		"type": "content-container-linear",
		"name": "topContainer",
		...
		"_editor_propertiesToEditRestrictedUser": {}
	},
	{
	...

There are 6 elements that can be separated by their names. In an unedited content.json file the order is topContainer (this element represents the tool bar), tabBarContainer (this element represents the tab bar), loadProgress (this element represents the progress bar), tabPageArea (this element represents the area where web pages are rendered), surfTimeContainer (this element is for internal use only) and popupWindow (this element represents the popups used for the zoom and language selections of the tool bar).

The 4 elements topContainer, tabBarContainer, loadProgress and tabPageArea are those that can be rearranged to change the overall look of the browser. The other two elements can be left untouched.

All element definitions are in the same order in the JSON document as they appear on the screen if you start SiteKiosk. To reposition an element you simply have to move its complete definition from opening bracket ({) to closing bracket (}) to the new place you would like the element to have on the screen.

If the elements are rearranged in the order tabPageArea, loadProgress, tabBarContainer, topContainer and the content.json file is saved, you will see this user interface when you start SiteKiosk:

Note that depending on how you reposition the elements and the SiteKiosk configuration you are using, there may be minor side effects, e.g. overlapping parts. Also note that the task bar of the SiteKiosk Chrome browser is not part of the content.json file, it can be found in this folder instead C:\Program Files (x86)\SiteKiosk\Skins\Chrome_NG_Skin.