How to Use
Technical Document







There are multiple ways to program your HTML pages with IntraLaunch. Here are a couple examples. jQuery is used because it simplifies things for us. There are additional code examples in the demonstration site under Advanced Features & Coding Examples and simplified examples here.

 Important!   Typically all paths must be escaped with an extra backslash because of JSON and jQuery. So a given absolute path might look like 'C:\\Windows\\explorer.exe' as shown below. This applies to all paths used in all parameters except URLs to resources via HTTP.


 Parameter Summary

Parameter Name Description
task: Specify what operation to do. 'run' will run the application specified by the program parameter. 'find' will try to find and launch the program specified in the program parameter where ever it is installed as defined in the registry's App Paths key. 'getdriveinfo' will return drive information. 'macro' is used to launch macros. 'check_connector' will determine if the connector is installed and responding. 'dir, 'deletefile' and 'deletefolder' are used for listing of files, see the code on the demonstration section for details.
Eg. 'find', 'getdriveinfo', 'run', 'macro', 'check_connector', 'deletefile', 'deletefolder', 'dir'
program: The program to execute, file to open or macro to launch. If launching a macro the task parameter must be set to 'macro'.
If task is set to 'dir' then program can be set to an HTML element ID which will be passed back so your script can act on a specific table/element (used when listing files).
Also see the options parameter details below.
Eg. 'C.:\\Windows\\notepad.exe', '\\NAS_SERVER1\path\program.exe', '%MY_DOCUMENTS%\\file.pdf', 'http://intranet.yourcompany.com/program.exe'
workingfolder: Suggest to the program being run where it should end up working in. Typically ignored by most programs. If listing files with a task of 'dir' this is the path to list (eg. workingfolder: 'C:\\Temp'), coding example available here (view the HTML source). If enumerating a drive for statistics workingfolder is set to the drive letter to check (eg. 'E:'), coding example available here.
Eg. 'C.:\\Temp', '%MY_DOCUMENTS%'
switches: Switches and parameters to pass to the program being run. If task is 'deletefile' or 'deletefolder' this switches parameter is the file or folder to delete. If listing files with a task of 'dir' this can be used as a filter to return certain files (eg. switches: '*.*', switches: '*.docx').
Eg. '/s /e', '%MY_DOCUMENTS%', 'C:\\Temp\\my_document.docx'
windowstate: The initial state suggested to the program being executed. Sometimes ignored by the application.
Eg. 'MAX', 'MIN', 'HIDE'
showerrors: Toggle whether or not IntraLaunch will show any errors at all when raised. Such as file not found errors. Sometimes you may wish to have IntraLaunch show an error dialog, or handle custom errors within javascript. Coding example available here and here.
Eg. 'true', 'false'
playsound: Attach a sound event to the program or operation being executed. Must be a .wav file. If the sound file is not found no error is raised and IntraLaunch silently continues. Some sound files can be found here. Coding example available here and here.
Eg. 'C:\\Windows\\cool_sound.wav', 'http://www.yourdomain.com/sound.wav'
log: Log the operation being executed to a log file specified here. If IntraLaunch cannot write to the log file path specified (such as C:\Windows) no error is raised. Coding example available here.
Eg. '%MY_DOCUMENTS\\run_log.txt', 'C:\\Temp\\file.log'
Example Log File
2016-06-10 @ 03:28:08:0638: RUN DEVICE_MANAGER
2016-06-10 @ 03:28:39:1480: RUN C:\\Windows\\notepad.exe
...
recallapp: If a application is already running IntraLaunch can try to refocus it. The value for recallapp must be the title of the process name. Only works for some applications. Coding example available here.
Eg. 'notepad'
options: Some flags can be specified for certain events. If running a program you can include 'OPTION_RUNAS_ADMIN' and IntraLaunch will attempt to run the program with elevated privileges if possible. UAC may ask the user for permission if enabled. 'OPTION_ONTOP' will attempt to make the program being executed always stay on top and visible. OPTION_ONTOP only works for some applications.
If opening a document (eg. task: 'run', program: 'C:\\files\\mydoc.docx'), you can add a flag of 'OPTION_EDIT' or 'OPTION_PRINT' and instead of opening the document in it's default associated program it will open it in its default associated editor, or attempt to print it. This is highly dependent on if the workstation already has these associations defined. For example for Word documents adding OPTION_PRINT will print the document immediately. OPTION_EDIT for an graphic file might open the file in Photoshop, as opposed to simple viewing it in the default photo viewer. If you right click on a file in the Windows File Explorer you should see the Edit option which corresponds to OPTION_EDIT.
'SHOW_PARENT' and 'HIDE_HIDDEN' are used for listing files with a task of 'dir'. SHOW_PARENT will include the parent .. directory if the path specified in workingfolder has one. And by default hidden files are included in a 'dir' listing, HIDE_HIDDEN will negate that.
Eg. 'OPTION_RUNAS_ADMIN', 'OPTION_ONTOP', 'SHOW_PARENT', 'SHOW_PARENT,HIDE_HIDDEN'



Single Object Example

<html>
   <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
   <script language="JavaScript" type="text/javascript"> var $jQuery = jQuery.noConflict(); </script>

   <script type="text/javascript">
     jQuery(document).ready(function()
     {
         jQuery("#example_link").on("click", function (event) 
         {      
           event.preventDefault(); // Recommended to stop the link from doing anything else
           document.dispatchEvent(new CustomEvent('funcIntraLaunch',
           {
              'detail': { task: 'run',
                       program: 'C:\\Windows\\notepad.exe',
                 workingfolder: '',
                      switches: '%MY_DOCUMENTS%\\switch.txt',
                   windowstate: 'max',
                     recallapp: '',
                       options: '',
                           log: '',
                     playsound: 'http://www.yourdomain.com/sound.wav',
                    showerrors: 'true'
                        } })); 
         });
     });
   </script>

   <body>
      <a href="#" id="example_link">Click me</a>
   </body>
</html>


A more practical way to using IntraLaunch is to define one single object, then call it (.intralaunch_link) in different ways using HTML5 data-attributes. This example shows three different links doing different things but all using the same object. This is much cleaner and preferred. The details of what to run for each href is held in the href's data attributes.


Common Object Example

<html>
   <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
   <script language="JavaScript" type="text/javascript"> var $jQuery = jQuery.noConflict(); </script>

   <script type="text/javascript">
     jQuery(document).ready(function()
     {
       jQuery(".intralaunch_link").on("click", function (event) 
       {      
         event.preventDefault(); // Recommended to stop the link from doing anything else
         document.dispatchEvent(new CustomEvent('funcIntraLaunch',
         {
            'detail': { task: jQuery(this).data('task'),
                     program: jQuery(this).data('program'),
                    switches: jQuery(this).data('switches'),
                 windowstate: jQuery(this).data('windowstate'),
                  showerrors: jQuery(this).data('showerrors'),
                         log: jQuery(this).data('log'),
                     options: jQuery(this).data('options'),
                   recallapp: jQuery(this).data('recallapp'),
               workingfolder: jQuery(this).data('workingfolder'),
                   playsound: jQuery(this).data('playsound')
                      } 
         })); 
       });
     });
   </script>

   <body>
     <a href="#" class="intralaunch_link" data-task="run" data-program="%MY_DOCUMENTS%\\Important Letter.docx" data-switches="" data-windowstate="max" data-showerrors="true" data-log="" data-recallapp="" data-workingfolder="" data-playsound="">Start new document</a>
     <a href="#" class="intralaunch_link" data-task="macro" data-program="PRINTER_MANAGEMENT_FOLDER" data-switches="" data-windowstate="" data-showerrors="true" data-log="C:\\Windows\\log.txt" data-recallapp="" data-workingfolder="" data-playsound="">Manage Printers</a>
     <a href="#" class="intralaunch_link" data-task="run" data-program="explorer.exe" data-switches="%MY_PICTURES%" data-windowstate="max" data-showerrors="true" data-log="" data-recallapp="" data-workingfolder="" data-playsound="C:\\Windows\\sound.wav">Open Windows File Explorer in 'My Pictures'</a>
   </body>
</html>