Jump to content
ddjfreedom

Recent Downloads with Feedback

Recommended Posts

An Alfred workflow for opening or revealing the most recently downloaded items in “~/Downloads”.

 
 
The items are sorted in decreasing order according to when they were added to the folder. Items are filtered by whether they contain the query as a subsequence. The result is displayed using the feedback functionality.
 
 
Use config.yaml in ~/Library/Application Support/Alfred 2/Workflow Data/recentdownloads.ddjfreedom/ to control the new default behavior:

 

install_action: ask, install, open

auto_start: ask, always, never

 

Updated:
1. added the option to delete files (holding 'ctrl') (by fmr)
2. result's icon matches file's icon
3. added the option to move files to trash (holding 'cmd') (by fmr)
4. changed the default behavior of certain files: if the item can be installed (an application, an dmg file, a zip file containing those files, etc), the workflow will prompt the user whether to install it. After the installation, if the item installed is an application, the workflow will prompt the user whether to launch it.
Edited by ddjfreedom

Share this post


Link to post

Nice workflow. Just a quick tip: you can tell Alfred to make the icon match a file's icon. In the resulting XML, it'd look something like this:

 

<icon type="fileicon">/path/to/file</icon>

 

Thanks. This is just what I was looking for.

Share this post


Link to post

Hey I suck at programming. Would you help on that? I tried installing your ruby gem but here is what i get:

 

 

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

 

xcrun: Error: could not stat active Xcode path '/Applications/Xcode45-DP4.app/Contents/Developer'. (No such file or directory)

 

 

(of course i get a whole lot more but these seem to be the most important ones).

I do have xcode installed as well as the command line tools.

Share this post


Link to post

I think moving the file to the trash instead of deleting it would be better, but other than that it's a great workflow. :-)

Share this post


Link to post

Great workflow! Two suggestions:

 

  1. Would it be an idea to differentiate between files and folders?
  2. Could you filter out the Icon? file?. It shows up if you've set a custom icon for the Downloads folder?

One final remark: currently delete does not work for folder items.  

Share this post


Link to post

BTW, changing the delete command to move the file/folder to the trash is 

mv {query} ~/.Trash

I'm aware of that but I prefer just deleting these files.  They are usually (re-)downloadable anyway.  But I can add another modifier to move to trash.  Then we'll both be happy :-)

 

included in my latest pull request on github: https://github.com/ddjfreedom/recent-downloads-alfred-v2/pull/2

Share this post


Link to post
Hey I suck at programming. Would you help on that? I tried installing your ruby gem but here is what i get:

 

 

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

 

xcrun: Error: could not stat active Xcode path '/Applications/Xcode45-DP4.app/Contents/Developer'. (No such file or directory)

 

 

(of course i get a whole lot more but these seem to be the most important ones).

I do have xcode installed as well as the command line tools.

 

According to http://stackoverflow.com/questions/11961032/xcrun-error-could-not-stat-active-xcode-path-volumes-xcode-xcode45-dp1-app-c, you need to run

sudo xcode-select -switch /Applications/Xcode.app

 

And I've updated the link in the original post. Now delete works both on files and folders, and hoding 'cmd' to move item to Trash. You can also download it here: http://d.pr/f/te4d

Share this post


Link to post
According to http://stackoverflow.com/questions/11961032/xcrun-error-could-not-stat-active-xcode-path-volumes-xcode-xcode45-dp1-app-c, you need to run

 

 

sudo xcode-select -switch /Applications/Xcode.app

 

I tried that but get the following:

 

 

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.
 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
 
 
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.5.6/ext/nokogiri/gem_make.out

 

 

 

I've sent a couple of pull requests - one for improved native handling of deletions and another to remove the  dependancy on nokogiri.

 

I'll look forward to that.

 

 
 

Share this post


Link to post

Thanks for the workflow.  One of my biggest pet peeves is wasting time finding what I just downloaded.

 

 This shares the same keyword as "View Recent Folders."  Easily changeable, just thought you'd like to know.

Share this post


Link to post

Hi, 

 

Very interesting workflow.

My problem is I do not see any items filtered.

 

I type this workflow keyword, "Recent Downloads" is selected 

then I type "enter". Then ... I can't do anything.

 

After typing "enter", I tried to insert the name of the latest download, it didn't work.

I even tried to type "enter", holding ctrl or cmd or option but my latest download

was still there...

 

I have nokogiri installed "require 'nokogiri' => True".

 

 

I am pretty sure I didn't understand how to make it work properly. 

Could you elaborate for the newbie that I am ?  :)

 

Thank you.

Share this post


Link to post
Hi, 

 

Very interesting workflow.

My problem is I do not see any items filtered.

 

I type this workflow keyword, "Recent Downloads" is selected 

then I type "enter". Then ... I can't do anything.

 

After typing "enter", I tried to insert the name of the latest download, it didn't work.

I even tried to type "enter", holding ctrl or cmd or option but my latest download

was still there...

 

I have nokogiri installed "require 'nokogiri' => True".

 

 

I am pretty sure I didn't understand how to make it work properly. 

Could you elaborate for the newbie that I am ?  :)

 

Thank you.

 

I'm not exactly sure why. One reason may be that folder

 

 

~/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data

 

doesn't exist. The workflow will store some data in a folder created in that folder, so if it doesn't exist, the workflow fails. 

Maybe you can use the newest build of Alfred 2. I think it will automatically create the folder. Or you can manually create it.

Share this post


Link to post

changed the default behavior of certain files: if the item can be installed (an application, an dmg file, a zip file containing those files, etc), the workflow will prompt the user whether to install it. After the installation, if the item installed is an application, the workflow will prompt the user whether to launch it.

 

 

Use config.yaml in ~/Library/Application Support/Alfred 2/Workflow Data/recentdownloads.ddjfreedom/ to control the new default behavior:

 

install_action: ask, install, open, cancel

auto_start: ask, always, never

 

 

new version is on AlfPT and http://d.pr/f/CAIi

Edited by ddjfreedom

Share this post


Link to post
Just another note,

Looks like it doesn't know how to handle .zip files. If the user selects a zip file and presses enter, nothing happens. 

 

I guess that the name of the zip file contains white space? Sorry about that. Just updated the workflow to address this. http://d.pr/f/YoTI

Share this post


Link to post

A couple of things. 

 

- I just want to use the script to display the most recent downloaded file. I have no use for the install etc... action you have added. Which is nice but I had disabled that from the v1 script othijus shared.

 

1) Are there any plans to have the script be capable of going down at least one directory to deep for those of us who auto-organize downloads with apps like Hazel and Glims for Safari?

 

2) I am not getting accurate results. Default clean install of 10.8.2 with Xcode and command line tools etc... but I can go to macupdate.com - download 3 files in a row and they are usually mixed up a bit with older folders residing in ~/Downloads (2-5 days old) appearing before the just downloaded files.

 

What are your system specs? I never had these problems with otijhuis's extension for alfred v1 so I am not sure why the results I am receiving are so off. Any ideas? Ruby v1.8.7 (default 10.8 version)

 

Perhaps it is Ruby or something else, so please if you do not mind would you share your system specs with me so I can try to figure out what is causing this behavior?

 

And lastly, anyway we might see the script be able to filter down one level to view downloads organized into dated folders?

 

Thanks for sharing this! I really hope I can get it to work as I had posted a request for a script just like this 4 or 5 days before you posted this workflow. Cheers!

Share this post


Link to post
Thanks, very handy..

 

fyi, Recycle bin is showing up in the list for me :-)

 

Is that also hidden? I just filter out all file names starting with '.'. I'll fix this.

 

A couple of things. 

 

- I just want to use the script to display the most recent downloaded file. I have no use for the install etc... action you have added. Which is nice but I had disabled that from the v1 script othijus shared.

 

1) Are there any plans to have the script be capable of going down at least one directory to deep for those of us who auto-organize downloads with apps like Hazel and Glims for Safari?

 

2) I am not getting accurate results. Default clean install of 10.8.2 with Xcode and command line tools etc... but I can go to macupdate.com - download 3 files in a row and they are usually mixed up a bit with older folders residing in ~/Downloads (2-5 days old) appearing before the just downloaded files.

 

Just realized that it will always check if there are stuff to install. Sorry about this. I'll fix it.

 

1) Do you mean display items from Downloads folder and all its sub-folders? Or display items from Downloads folder and walking down folders? If the latter, I'll have to set folder's 'valid' key to "no", and no operation can operate on it.

2) The workflow uses

mdls -name kMDItemDateAdded -raw "Filename"

to get the time when an item is added to Downloads, and use this to sort the item. Because mdls is quite slow, the workflow caches the result in a file under 

~/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/recentdownloads.ddjfreedom

I'm guess the cache becomes inconsistent with the order of files in Downloads. Another possible reason is that the workflow uses file name as uid, maybe Alfred changes the results a bit.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...