Show Open Recent Files List

Thanks for sharing.

As you noted, not with the native KM Prompt.
But it will if you use MACRO: Spotlight Search Prompt by @DanThomas.

I have made some small mods to your script, and then used the results in the SSP:

@sims Script with My Mods

# $time.now(-$KMVAR_Local__TimeBack) does NOT work.
# So, must set time back directly for now.

mdfind -onlyin "$KMVAR_Local__SearchFolder" '(kMDItemFSContentChangeDate > $time.now(-24h))' \
| tr '\n' '\0' \
| xargs -0 -n1 stat -f "%m %Sm %N" \
| sort -rn \
| cut -d ' ' -f2-4,6-

I added two KM Variables to make it easier for each user to customize. Unfortunately, the $time.now does not work with Local__TimeBack. So, for now, we have to set the time directly in the script.

Here's my macro which uses this script with the SSP:

MACRO:   Get Recent File List [Example]

--- VER: 1.0    2018-05-15 ---

DOWNLOAD:

Get Recent File List [Example].kmmacros (9.5 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

This macro requires the use of this sub-macro, which you must download separately:
MACRO: Spotlight Search Prompt


image


Known Issues:

  1. $time.now(-$KMVAR_Local__TimeBack) does NOT work.
    • so the time back is set manually for now.
  2. Too many unwanted results of mdfind search
    • When I ran it using my Home folder (~), it picked up lots of files in the ~/Library folder that I don't want to see, and also lots of files used by Outlook 2011 in my ~/Documents folder
    • So, we need a way to exclude selected folders
  3. SSP Prompt shows entire file path, which makes the list hard to read, and causes some file names to not be visible.
    • It is possible with SSP to just show the file name, display full path in status line, and return full path.
    • To do this we need to return the list from the Shell Script as a JSON string with these fields.

If anyone knows how to fix any of these issues, please post below.

1 Like