Creating a script for a specific instance of Synergy

You can create or edit a script to call the specific instance of Synergy you are working with on your machine.

Each instance of Synergy is assigned an instance ID, which can be found in the About box. This changes every time Synergy is launched, but can be used to check against your script to ensure that the correct instance of Synergy has been called.

The first line of any script or macro, designed to call the specific instance of Synergy, must be:
'%RunPerInstance

Take a look at the API example script: The first lines of a script, to see an example of how to script for a specific instance of Synergy.

  1. Type the line above as your first line.
  2. Type explanatory comments to explain the code.
  3. Type
    Option Explicit
    to reduce programming errors.
  4. Type
    SetLocale("en-us")
    to force your system to interpret numerical values as they are in the US.
  5. Type
    Dim SynergyGetter, Synergy
    On Error Resume Next
    Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
    On Error GoTo 0
    If (Not IsEmpty(SynergyGetter)) Then
      Set Synergy = SynergyGetter.GetSASynergy
    Else
      Set Synergy = CreateObject("synergy.Synergy")
    End If
    to create an OLE automation object which starts the specific instance Synergy that you are working in.
  6. Continue with your scripting.
  7. Type
    MsgBox "Script Complete"
  8. Type
    Wscript.Quit