Accordance power user Rubén Gomez had the great idea of making a script to enable Flex Search in Accordance. Flex Search is a new powerful search feature in Accordance to provide new options for searching.
I'm posting here my version of a script that toggles between Flex Search and Exact Search in the Preferences. It is scripting the user interface of the Preferences pane in Accordance 10, so you can actually see the script doing it's work. As much as anything, this script may give some of you some help getting started at scripting the preferences yourself:
-- This script will toggle Flex/Exact search in Accordance preferences
tell application "Accordance" to activate
tell application "System Events"
tell process "acord"
click menu item "Preferences…" of menu 1 of menu bar item "Accordance" of menu bar 1
delay 0.2
-- select "Search Tabs" panel
set selected of row 12 of outline 1 of scroll area 1 of window "Preferences" to true
delay 0.2
-- toggle a checkbox to enable the "OK" button
-- necessary because clicking radio button does not enable "OK" button
click checkbox 1 of window "Preferences"
click checkbox 1 of window "Preferences"
set v to value of radio button "Flex Search" of radio group 1 of window "Preferences"
if v = 0 then
-- click to appropriate radio button
click radio button "Flex Search" of radio group 1 of window "Preferences"
else
click radio button "Exact Search" of radio group 1 of window "Preferences"
end if
delay 0.2 -- make this delay 1 or 2 seconds if you want longer to see what was switched.
-- dismiss Preferences
click button "OK" of window "Preferences"
end tell
end tell