I created an AppleScript for cleaning the clipboard which had this command:
tell application "System Events" to set the clipboard to ""
How would I create an AppleScript that did this with this shell script in Catalina latest version?
I tried:
do shell script "defaults delete -g NSNavRecentPlaces"
and got this error message:
error "2020-06-27 22:20:11.304 defaults[1830:54087]
Domain (kCFPreferencesAnyApplication) not found.
Defaults have not been changed." number 1
How would I get an AppleScript to work for this sort of thing like the clipboard one I made?
Any advice appreciated on this!
Best Answer
In AppleScript, you do not need System Events to clear the clipboard, just use:
To use the above AppleScript command from Terminal, use the following command:
To clear the general clipboard from Terminal, not using AppleScript, use the following command:
To clear the find clipboard from Terminal, not using AppleScript, use the following command:
That all said, there is a discrepancy between the title of your question and the AppleScript code you're wanting to run in Terminal.
If you are wanting to clear the Recent Items on the Apple menu, then the following AppleScript command will do that:
To use that in Terminal: