If used as a Fast Motion, neither the clipboard nor “System Occasions” is required. The utilization of the Fast Motion can be to pick some textual content and select the workflow from the Companies contextual menu, the place it is going to do its factor with the choice.
For a Fast Motion, the header declares what the workflow will obtain. Setting this to obtain textual content in any software will decide the context so as to add the workflow to the Companies contextual menu – relying on the settings, it could be added to the primary Companies menu, however will probably be obtainable in a kind of Companies menus for utilization with any choice. You may test the Companies Settings menu merchandise to ensure the workflow is enabled.
The “Run AppleScript” motion receives the workflow merchandise(s) in its enter argument (which can all the time be a listing), so you will get the primary phrase from that to be used with the dictionary and log. The outcomes returned from the motion might be handed to different actions within the workflow (akin to “Copy to Clipboard”) for additional processing as desired, so the script can be one thing like:
on run {enter, parameters}
set theWord to first phrase of (enter as textual content) -- only one phrase
-- Log file path
set logPath to (POSIX path of (path to desktop)) & "dictionary_log.txt"
do shell script "contact " & quoted type of logPath
-- Append the phrase to the log
do shell script "echo " & quoted type of theWord & " >> " & quoted type of logPath
-- Open Dictionary to that phrase
do shell script "open dict://" & quoted type of theWord
return enter -- go the complete choice to following actions to carry out different stuff as desired
finish run
