AppleScript

TextSoap supports a scripting interface to allow you to access the text processing facilities within AppleScript.

Tell Application Differences

Depending on your edition of TextSoap (Direct Download, Setapp), you will need ot use a different version of the tell application statement to talk to TextSoap.

If you are using the Direct Download Edition, the tell statement should read as:

tell application "textsoap8"
    cleanClipboard with "Convert to Uppercase"
end tell

If you are using Setapp Edition, the tell statement should read as:

tell application "TextSoap"
    cleanClipboard with "Convert to Uppercase"
end tell

Basic Scripting

This example demonstrates how to use basic scripting. Commands are wrapped in tell statements to direct them to the application. Open the TextSoap scripting dictionary in the script editor for a list of all the commands and parameters.

tell application "TextSoap"
    set oldTextValue to "This is some starting text"
    set newTextValue to cleanText oldTextValue with "Convert to Uppercase"
end tell

Here is an example of the cleanClipboard command. It will apply the given cleaner to the contents of the clipboard.

tell application "TextSoap"
    cleanClipboard with "Convert to Uppercase"
end tell

Pick a Cleaner

You can also use the pickCleaner command to display a built-in interface. It returns the name of the cleaner to use. If the user cancels, the result is “#CANCEL”.

Optional : you can also specify a starting group. If not specified, the dialog will use the last selected group by the user (Standard if user hasn’t selected).

See below for examples of both:

tell application "TextSoap"
    set resultValue to pickCleaner
    cleanClipboard with resultValue
end tell
tell application "TextSoap"
    set resultValue to pickCleaner with starting group "Dates"
    cleanClipboard with resultValue
end tell

Build Your Own Interface

Along with the basic apply cleaner, you can get group names and cleaner lists. The following snippet demonstrates how to get the group names and cleaners from a specific group. With this information, it is possible to build your own interface to TextSoap’s features using AppleScript, such as a popup menu.

tell application "TextSoap"
    set groupValues to groupNames
    set listValues to groupItems from "Custom"
end tell

textsoap8Agent (Deprecated)

Direct download users scripting textsoap8Agent, it is recommended you update your scripts to talk directly to the main app. textsoap8Agent is being deprecated. All the cleaning commands for textsoap8Agent are also supported by the main app.

Note: textsoap8Agent is not included in the Setapp Edition. If you have a script that uses textsoap8Agent, change the tell statement to use the main app directly (as previously discussed).

Advanced

Advanced users who want to mimic some of the textsoap8Agent specific behavior can use the following commands.

tell application "TextSoap"
    enableAgentMode -- transform app to use agent mode. Command is ignored if app is already in agent mode. 
    disableAgentMode -- turn off agent mode. Returns app to standard app mode if needed
    set mode to isAgentMode -- return whether app is currently in agent mode
end tell 

Caution: Changing the main app’s agent mode via AppleScript can bring some very unexpected results. For this reason, you are discouraged from using these commands unless you have a specific need to mimic specific textsoap8Agent behavior.