Prerequisites for preparation on webserver side.
1. locate file *\Clients\www\software\html5\settings.js
2. change variable according to the example > W.customerScripts = { 0: "../custom1.js" };
3. place custom1.js into *\Clients\www\custom1.js
Prerequisites on rdp session side.
A: to be able to exchange messages with RDP session you need running webime.exe process that represents WEBIME - RDPchannel. Please check, that each time you start any new RDP session that process webime.exe gets started together with the session. Usually that should be always the case since this process is used to push file upload messages, keyboard language switching messages and screen resizing messages, and except that it is needed for exchanging JavaScript messages too.
B: download and install AutoIT, that program is necessary to compile the AutoIT scripts to executable files, AutoIT is pretty small and allows you to enter the world of self made scripting very fast.
(Please consider here, we won't give you any future help how to rewrite the AutoIT script to another languages like Delphi, C++ etc., that stays always your task if you decide to do that!)
C: now main last part. You get attached in zip archive 3 different AutoIT scripts that behave differently. The scripts contain example of JavaScript body which may be changed in order to meet your needs.
send_first_and_exit_after_first_back.au3 - this script sends first message to browser and waits for first message from browser back, very useful if you want to get some specific information from browser and display it inside RDP session.
send_first_and_exit_immediatelly.au3 - this script sends first message to browser and exits immediatelly, useful if you want to send some message from RDP session to browser without future interaction.
send_first_and_listen_permanently_for_following.au3 - this script runs in permanent mode, the sending of first message can be commented out if not needed. Usually first message is needed to indicate to browser that your listener was started. Afterwards the program stays in listening(server) mode and waits for future incoming messages from browser permanently. If you send first message but want to replay this first message each time the browser tab was refreshed and/or session was reconnected then replace _sendSingleMessage($data) by _sendPersistentMessage($data) or comment it completely out if you do not need to send first initial message to browser.
To compile these files to executables (consider you installed full AutoIT bundle before) just click with RIGHT mouse on any *.au3 script and compile it! Remember, AutoIT handle specific characters differently than JavaScript so as example double quotes have to be inserted twice "" while in JavaScript double quotes have to be preceded with back slash \" in order to be part of textual string. For future information about such details Google for it, do not ask such questions in support ticket, such tickets will be closed without future support since such information can not be handled by our first level support!
Now as handled in Prerequisites for preparation on webserver side -> 3. *custom1.js* place some function like
window.mySpecificFunction = function(abc) { alert(abc); };
and call it from Autoit script by editing the matched inner JavaScript body, example of call
window.mySpecificFunction(""some dummy string"");