Clear recent file list in AppleScript? I created an AppleScript for cleaning the clipboard which had this command:
tell application &quot;System Events&quot; to set the clipboard to &quot;&quot;

How would I create an AppleScript that did this with this shell script in Catalina latest version?
I tried:
do shell script &quot;defaults delete -g NSNavRecentPlaces&quot;

and got this error message:
error &quot;2020-06-27 22:20:11.304 defaults[1830:54087] 
Domain (kCFPreferencesAnyApplication) not found.
Defaults have not been changed.&quot; 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!
In AppleScript, you do not need System Events to clear the clipboard, just use:
set the clipboard to &quot;&quot;

To use the above AppleScript command from Terminal, use the following command:
osascript -e 'set the clipboard to &quot;&quot;'

To clear the general clipboard from Terminal, not using AppleScript, use the following command:
pbcopy &lt; /dev/null

To clear the find clipboard from Terminal, not using AppleScript, use the following command:
pbcopy -pboard find &lt; /dev/null


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:
tell application &quot;System Events&quot; to ¬
    click menu item &quot;Clear Menu&quot; of ¬
        menu 1 of ¬
        menu item &quot;Recent Items&quot; of ¬
        menu 1 of ¬
        menu bar item &quot;Apple&quot; of ¬
        menu bar 1 of ¬
        application process &quot;Finder&quot;

To use that in Terminal:
osascript -e 'tell app &quot;System Events&quot; to click menu item &quot;Clear Menu&quot; of menu 1 of menu item &quot;Recent Items&quot; of menu 1 of menu bar item &quot;Apple&quot; of menu bar 1 of process &quot;Finder&quot;'