ScriptX logotype
  • Home
  • Pricing
  • Applications
  • News
  • Documentation
Free Trial Downloads

Orchestrator for ScriptX.Services for Windows PC

Discover a better way to print
  • Consistent browser-based printing, every time
  • Centralised control of print settings
  • Increase productivity and eliminate wastage
  • Easy to install and highly customisable
  • Fast and reliable, 24/7 customer support
  • Home
  • Pricing
  • Applications
  • News
  • Documentation
Developers ›  Knowledge Bank ›  How To Guides ›  ScriptX.Services ›  Orchestrator for ScriptX.Services for Windows PC

Orchestrator for ScriptX.Services for Windows PC

Introduction

ScriptX.Services for Windows PC does not run as a system service, it runs per user.

ScriptX.Services Orchestrator assists in the case of multiple users concurrently signed in to a Windows PC with ScriptX.Services for Windows PC running for each user.

If the PC is not shared, or all users always sign out at the end of their session then Orchestrator is not helpful because all users will use the same port (typically the default port 41191).

Orchestrator does not assist ScriptX.Services for On Premise Devices or ScriptX.Services for Cloud.

What happens without Orchestrator

Since v2.15.1 as each user signs in, concurrently with other users, ScriptX.Services for Windows PC starts up and assigns an unique port to itself. The port number is assigned as the next available port after the configured default port (for first run this is 41191 typically).

So, the first user to sign in will use port 41191, the second port 41192, the third port 41193 and so on. The port used is recorded in the appsettings.json file for the user (typically located at C:\Users\[UserName]\AppData\Local\MeadCo\ScriptXServices) and will be used as the configured default port the next time the user signs in.

So far, so good. The issue now is that javascript code in the client browser is likely to be attempting to use the default port for connecting to the server (http://127.0.0.1:41191) and that port will be wrong for all users after the first.

There are 3 possible solutions to this problem :

  1. Dynamically generate the client side code to use the correct port for the user. To make this work effectively most likely requires that the port for a user is recorded in the user's profile data held in the application and is also specified in the appsettings.json file for the user (typically located at C:\Users\[UserName]\AppData\Local\MeadCo\ScriptXServices).

    Alternatively it is possible to store the port used in the user's browser local storage or a cookie.

    Either may be complex to code and maintain.

  2. If using the ScriptX.Services v2.15 and later and v1.9 or later of the  ScriptX.Services Client Library (implements compatibility to ScriptX.Addon for ScriptX.Services) then the library will take the given server url, including port and try to connect to it.

    If the connection fails it will increment the port and try the next, trying up to 10 ports.

    This can be a slow process that may have a significant negative effect on the user's experience.

  3. Use Orchestrator for ScriptX.Services for Windows PC and either v10.1 or later of  ScriptX.Services Client Library or use the Orchestrator API in your own code.

    Orchestrator is built-in and available with ScriptX.Services for Windows PC v2.17.0 and later, is simple to use and does not negatively effect the user's experience.

What happens with Orchestrator

When a user signs in, Orchestrator starts up and listens on the configured port (typically 41190).

The way that ScriptX.Services for Windows PC works does not change; as each user signs in, ScriptX.Services for Windows PC starts up and assigns an unique port to itself.

Orchestrator is built-in and available with ScriptX.Services for Windows PC v2.17.0 and later.

When the user becomes inactive, for example because another user is signing in, Orchestrator stops listening on the configured port. This makes the same port available to the new active user.

Orchestrator provides an API callable by the client browser javascript code that returns the port used by ScriptX.Services for Windows PC for the current user.

This is a single, quick, call that will not negatively impact the user's experience.

Using Orchestrator

With  ScriptX.Services Client Library

Please note that in the examples below e29212c9-3c6f-41ac-8078-4596738fdb59 should be replaced with your own License GUID.

Using attributes to specify the connection to ScriptX.Services

Specify that Orchestrator should be used by adding the data-meadco-orchestrator attribute, for example:

<!-- Add.on to scriptx.services compatibility -->
<script src="//cdn.jsdelivr.net/npm/scriptxprint-html@1.11.0/dist/meadco-scriptxservices.min.js"
    data-meadco-server="http://127.0.0.1:41191"
    data-meadco-orchestrator="41190"
    data-meadco-license="e29212c9-3c6f-41ac-8078-4596738fdb59"
    data-meadco-license-path="warehouse"
	data-meadco-license-revision="0"
	data-meadco-syncinit="false"
>
</script>
Using code to specify the connection

Set the "MeadCo.ScriptX.Print.orchestrator" property to a non-zero value to enable use of Orchestrator. This must be done before calls to connect to ScriptX.Services or apply a license. For example:


With "fetch" based code

The API is simple and requires no authentication. Default fetch() options should work.

It would be reasonable to assume that if the call fails then Orchestrator ScriptX.Services is not available or not running for some reason rather than there having been an error at the server.

 response is port: not run yet (0 means failure, see console).

  • Knowledge Bank
  • 'How To' Guides
    • ScriptX.Add-on
      • Introduction
      • Installing ScriptX on client PCs
      • Basic printing with ScriptX
      • Advanced printing features
      • Backwards compatibility
      • How to check if ScriptX is installed
      • MeadCoScriptXJS Library
      • License deployment
      • Client-side printing samples
    • ScriptX.Services
      • Introduction
      • Getting started
      • Maintaining investment in current code
        • Stage 1: Adding UI
        • Stage 2: Printing with ScriptX.Services
        • Stage 3: Summary and review
        • Stage 4: Error reporting
        • Stage 5: Prompted printing
        • Stage 6: Preparing for advanced uses
        • Stage 7: WaitForSpoolingComplete
        • Stage 8: Recommendations for some common issues
      • MeadCoScriptXJS Library
      • Printing with the API
      • Installing ScriptX.Services
        • For Windows PC
        • For On Premise Devices hosted on Windows Server
        • For On Premise Devices hosted on Windows 10/11
        • Configure options For On Premise Devices
        • Cloud
      • Orchestrator
      • Debugging
      • License deployment
        • For Windows PC
        • For On Premise Devices
      • Samples
        • Configure for Windows PC
        • Configure for On Premise
        • Configure for Cloud
    • Security Manager
      • Deploying a license or revision
  • Technical Reference
    • ScriptX.Add-on
      • factory
        • baseUrl
        • ComponentVersionString
        • IsUniqueIDAvailable
        • OnDocumentComplete
        • relativeUrl
        • ResetUniqueID
        • ScriptXVersion
        • SecurityManagerVersion
        • Shutdown
        • UniqueID
      • printing
        • AddPrinterConnection
        • BatchPrintPDF
        • BatchPrintPDFEx
        • bottomMargin
        • collate
        • copies
        • currentPrinter
        • DefaultPrinter
        • disableUI
        • duplex
        • duplex2
        • EnumJobs
        • EnumPrinters
        • footer
        • GetJobsCount
        • GetMarginMeasure
        • header
        • headerFooterFont
        • IsSpooling
        • IsTemplateSupported
        • leftMargin
        • onafterprint
        • onbeforeprint
        • onbeforeunload
        • onpagesetup
        • onuserpagesetup
        • onuserprint
        • onuserprintpreview
        • orientation
        • OwnQueue
        • pageHeight
        • PageSetup
        • pageWidth
        • paperSize
        • paperSource
        • paperSource2
        • portrait
        • Preview
        • Print
        • printBackground
        • printer
        • PrintHTML
        • PrintHTMLEx
        • PrintPDF
        • PrintSetup
        • printToFileName
        • RemovePrinterConnection
        • rightMargin
        • SetMarginMeasure
        • SetPageRange
        • SetPreviewZoom
        • SetPrintScale
        • Sleep
        • templateURL
        • topMargin
        • TotalPrintPages
        • unprintableBottom
        • unprintableLeft
        • unprintableRight
        • unprintableTop
        • WaitForSpoolingComplete
      • printerControl
        • attributes
        • Bins
        • Forms
        • isLocal
        • isNetwork
        • isShared
        • Jobs
        • location
        • name
        • Pause
        • port
        • Purge
        • Resume
        • serverName
        • shareName
        • status
      • Job
        • Delete
        • Pause
        • Restart
        • Resume
      • enhancedFormatting
        • allFooterHeight
        • allHeaderHeight
        • allPagesFooter
        • allPagesHeader
        • extraFirstFooterHeight
        • extraFirstPageFooter
        • firstFooterHeight
        • firstHeaderHeight
        • firstPageFooter
        • firstPageHeader
        • pageRange
        • printingPass
      • rawPrinting
        • printer
        • printDocument
        • printString
    • ScriptX.Services
      • Web service API
        • Service Description
          • (GET)
        • Licensing
          • licensing (GET)
          • licensing (POST)
          • licensing/ping (GET)
        • PrintHtml
          • settings (GET)
          • deviceinfo (GET)
          • htmlPrintDefaults (GET)
          • print (POST)
          • status (GET)
          • download (GET)
          • canceljob (PUT)
        • PrintPdf
          • print (POST)
          • status (GET)
          • download (GET)
        • PrintDirect
          • print (POST)
      • Orchestrator API
    • Security Manager
      • How it works
      • License Expiry
      • Testing for a valid license
      • About the license file (.mlf)
        • LICENSE
        • APPLICENSE
        • TITLE
        • DOMAINS
        • DOMAIN
        • PERMISSION
      • API
        • Apply
        • License
        • result
        • validLicense
  • Articles
    • Dialogs with ScriptX.Services
    • Accessing protected content
    • Long term servicing (LTS)
 
ScriptX logotype
Home Pricing Applications News Contact us Documentation

© 2023 Mead & Co Limited.

Privacy and cookie policy

E: feedback@meadroid.com
Follow us:
LinkedIn   GitHub
X

Warning:

This ScriptX.Add-on sample can only be viewed using Internet Explorer.