My favourite Alfred workflow no longer works and I have no idea why. The developer has moved to Windows and stopped supporting it, so I've had to come up with a janky workaround for its best feature: list recent documents of the front app.
Here's a link to the workflow:
Are there any Python experts here who might be able to help port this over as a KM macro or, failing that, could help me diagnose the point of failure?
Not me, but these changes work for me. Is this the janky workaround?
In main.py change:
if filePath.endswith(".sfl2"):
if __debug__: print("#FileType: sfl2") # noqa
itemsLinkList = ParseSFL2(filePath)
elif filePath.endswith(".sfl"):
if __debug__: print("#FileType: sfl") # noqa
itemsLinkList = ParseSFL(filePath)
to:
if filePath.endswith(".sfl2"):
if __debug__: print("#FileType: sfl2") # noqa
itemsLinkList = ParseSFL2(filePath)
elif filePath.endswith(".sfl3"):
if __debug__: print("#FileType: sfl3") # noqa
itemsLinkList = ParseSFL2(filePath)
elif filePath.endswith(".sfl"):
if __debug__: print("#FileType: sfl") # noqa
itemsLinkList = ParseSFL(filePath)
Then in the rr Script Filter change:
if [ $(version $macOSVersion) -le $(version "10.12") ]; then
MRUfileExt="sfl"
else
MRUfileExt="sfl2"
fi
to:
if [ $(version $macOSVersion) -le $(version "10.12") ]; then
MRUfileExt="sfl"
else
MRUfileExt="sfl3"
fi
1 Like
Oh my goodness! Why didn't I check the GitHub issues tab?! I'd only looked on the Alfred forum. 
That's all of them working now except for ra
(Recent Apps), which I don't really need anyway. I'm curious to know if you managed to get that working too...?
1 Like
I feel you. Long-time Alfred user with a lot of experience hunting down/cobbling together fixes for abandoned workflows. Alfred has a helpful community and responsive devs, but unlike this forum where unanswered questions are almost unheard of, sometimes the answer is crickets.
If you've made the other changes, all you have to do is update the Recent Apps script filter to "sfl3." Here's the entire script in case there was something else I changed and forgot about it.
# python -O xxx.py, run
# python xxx.py, debug
macOSVersion=$(sw_vers -productVersion | cut -d '.' -f 1,2)
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [ $(version $macOSVersion) -le $(version "10.12") ]; then
/usr/bin/python -O main.py "${HOME}/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.RecentApplications.sfl"
elif [ $(version $macOSVersion) -lt $(version "12.3") ]; then
/usr/bin/python -O main.py "${HOME}/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.RecentApplications.sfl3"
else
/usr/bin/python3 -O main.py "${HOME}/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.RecentApplications.sfl3"
fi
1 Like
Ahhh. It turns out it was working, but unlike the other filters, I have to add a space after ra
.
Thanks so much for helping me out with this. Nice to have this feature back!
1 Like
Do you have this issue?
I use rf
and instead of only showing me recent folders, it also shows me a couple of random files that begin with "rf".
For some reason it's always those two random things.
Check your default search results. Folders would normally show up in this case for me because I've selected Folders in my default results. See if you have anything checked there that causes the .rb file to show up.
I long ago renamed the script filters in this workflow by prefixing them with a semicolon (;ra,;rf) because I didn't want to pick up default results. Come to think of it, I should probably deselect Folders from default results because I can search folders with "f (search term)"
1 Like
Ahhhh... I had to deselect "Folders in Home" and manually add any directories I'd like to show. Sorted now. Thanks!
1 Like