MacOS – creating a resident workflow with automator

applescriptautomationautomatorcopy/pastemacos

I currently have a simple workflow that gets the contents of the clipboard and creates a new text file from those contents on the desktop.

problem is, i have to run the workflow everytime i need my clipboard dumped in the text file

is there any way i could create a workflow/application/service using automator that runs in the background and dumps the contents of the clipboard into the text file everytime the contents of the clipboard change?

alternatively, is there any app that would accomplish the same?

Best Answer

I recommend designing such a process in AppleScript. AppleScript is not capable of just sitting and detecting a clipboard change, but you can set a regular interval for it to check your clipboard. Using variables, you can deduce if the clipboard data changes over time and set an IF THEN statement to run the text file process each time a change is detected. As far as having this run in the background, you can make the AppleScript a login item through System Preferences.

Here is a good template for polling the clipboard for changes. And here is a good starting point for the AppleScript code to copy into a text file.