help | 13 Handling scripts
13 Handling scripts
Swyx Desktop for macOS is scriptable from version 2.1.0.
Thus you can write scripts and workflows via AppleScript to automate repetitive tasks.
These can be executed from the Script Editor or automatically in Swyx Desktop for macOS when a call comes in.
To be able to use scripts for an incoming call, proceed as follows:
*Enable the use of scripts in Swyx Desktop for macOS and deposit a script (To enable the use of scripts in Swyx Desktop for macOS).
*Add Swyx Desktop to the script editor library to get access to commands and objects of the app (To add the Swyx Desktop for macOS to the script editor library).
*Add the script to the script folder of the Swyx Desktop App (To use an existing script).
* 
A script can also be used with Automator, a macOS tool for creating automated workflows, to perform certain actions in Swyx Desktop for macOS.
To enable the use of scripts in Swyx Desktop for macOS 
1 In the menu bar, click on Swyx Desktop | Preferences.
2 Click on Logging.
3 Activate the function Execute scripts on incoming call.
*All scripts and workflows are executed under '~/Library/Application Scripts/com.swyx.Swyx-Desktop/' when a call comes in.
4 Click on Open script folder ... to deposit scripts. See also To use an existing script.
* 
The first time you run a script, your Mac prompts you to allow it to run (macOS 10.14 Mojave).
You can change the settings at a later time under "System settings | Security | Privacy | Automation".
To add the Swyx Desktop for macOS to the script editor library 
1 Open the app Script Editor.
2 Click on Window | Library.
3 Click on + and add "Swyx Desktop" to the library.
4 Open the Swyx Desktop Suite by double-clicking on Swyx Desktop within the library.
*All commands and objects for controlling the Swyx Desktop App are displayed.
The following commands and objects are available:
*CallInfo
Can be used to process the caller's first and last name, phone number, call start and end times, and call type ("Missed”, “Voicemail”, “Incoming”, “Outgoing”).
*ForwardingInfo
Controls call forwarding, e.g. if no reply, on busy, for all calls.
*Connection
Contains connection parameters such as the phone number or the phone number parameter "Private" or "Work".
*call
Can be used to start a call to a phone number transferred as a parameter.
*callmissed
Can be used to set up a call to the number of the last missed call.
*getcalls
Can be used to retrieve the phone number transferred as a parameter from the call information of a specific call in the event list.
*hangup
Can be used to end a current call.
*open
Can be used to open a URL transferred as a parameter.
*findcontactnumbers
Can be used to use a contact's phone numbers that match the name transferred as a parameter.
*application
This is the top level object for accessing or setting other properties, such as status, status text etc..
To use an existing script 
1 In the menu bar, click on Swyx Desktop | Preferences.
2 Click on Logging.
3 Click on Open script folder ....
4 Drag and drop the desired script into the Finder window.
The script must contain a function called "incomingCall" with the following four parameters:
function incomingCall(number, firstname, lastname, company) {
// put your code here
}
The script stored here will be executed on the next incoming call.
Last modified date: 12.17.2021