Dialectic Icon

Preprocessing AppleScript Format

As you dial, the number provided can be preprocessed with an AppleScript before passing through the rest of the Dialing Rules and on to Dialectic for dialing.

You specify the script to be used for preprocessing in the Dialing Rules by checking the “Preprocess AppleScript:” control and then choosing the script file. You can also simply drag and drop your script into the script path field. If you no longer want to use the specified preprocessing script, uncheck the “Preprocess AppleScript:” checkbox. For example scripts that can be used with Dialectic as a preprocessing script (and other items), see the Dialectic Online Resources at:

http://www.jonn8.com/dialectic/resources/

The preprocessing script must contain the handle_preprocess_number_action handler using the following format:

script icon
on handle_preprocess_number_action(the_number)
 
     --Your code goes here.
 
     return the_number
end handle_preprocess_number_action

This format accepts a single parameter, the_number, which is the number Dialectic has been asked to dial. Your script should transform this number as necessary and then return the result to Dialectic to continue processing. The returned result can be one of two things:

As an example, here is a script for stripping all formatting other than digits:

script icon
on handle_preprocess_number_action(the_number)
     set the_number to the_number's characters
     repeat with i from 1 to (count the_number)
          if item i of the_number is not in "1234567890" then set item i of the_number to ""
     end repeat
     set the_number to the_number as string
     return the_number
end handle_preprocess_number_action

This next example will test to see if the number starts with a specified country code and, if so, return the number and tell Dialectic that this should be treated as a Literal call:

script icon
property local_country_code : "+1"
 
on handle_preprocess_number_action(the_number)
     if the_number starts with local_country_code then return {false, the_number}
     return the_number
end handle_preprocess_number_action

Open

Open Dialing Rules

Related Topics

Dialing Rules

Online Resources

Was this page helpful? Were there errors, inaccuracies, or typos?
Could something have been explained better? If so, please let us know. 

Copyright © 2017 JNSoftware LLC. All Rights Reserved.
All other products mentioned are copyright of their respective owners.
No endorsement of or affiliation with any third-party product or service is implied.