Jump to content

Getting at the Clipboard History


Recommended Posts

Is there any way to get at the clipboard history and manipulate it in workflows? I would like to clip a bunch of urls, then have an applescript download each one. Ideally I would like to have applescript copy the most recent clipboard to the system clipboard, then delete the most recent clipboard from history.

Link to comment

Is there any way to get at the clipboard history and manipulate it in workflows? I would like to clip a bunch of urls, then have an applescript download each one. Ideally I would like to have applescript copy the most recent clipboard to the system clipboard, then delete the most recent clipboard from history.

 

It's possible but not really something recommended. You could query Alfred's clipboard.alfdb in ~/Library/Application Support/Alfred 2/Databases

 

If you query the clipboard table you could grab the most recent clipboard items.

Link to comment

It's possible but not really something recommended.

 

Ahem, definitely don't go digging around in that folder or the Alfred databases. Alfred has these open most of the time and if you mess with these while he is using them, data could get corrupt.

Link to comment
  • 6 years later...

I think you can solve that by issuing an exclusive lock on the db while modifying it:

PRAGMA locking_mode = EXCLUSIVE;
BEGIN EXCLUSIVE;

I plan on adding that to my alfred-clipboard.sh script in the future when I implement timstamp rewriting to make the history infinite:

BTW if anyone is looking for a full script example that can clone, read, merge, etc otherwise poke into the Alfred clipboard db, you can find the source for my implementation here:
https://gist.github.com/pirate/6551e1c00a7c4b0c607762930e22804c

Edited by theSquashSH
Link to comment
7 minutes ago, theSquashSH said:

I think you can solve that by issuing an exclusive lock on the db while modifying it

 

Please don't do that. If you're going to write to the database, quit Alfred while your script is running, then restart it, instead. (And back up the database first.)

 

If your script starts messing up people's clipboard history, the Alfred team will get the support requests. And Andrew will likely respond by changing Alfred to acquire an exclusive lock on its own databases.

 

It's not possible to run Alfred 3 & 4 at the same time, which is a bit of a pain for workflow developers, because the Node crowd were causing problems and didn't fix them.

 

So, please don't interfere with Alfred's functioning like that.

Link to comment
5 hours ago, theSquashSH said:

I think you can solve that by issuing an exclusive lock on the db while modifying it

 

Please do not exclusively lock Alfred's databases, as this will have a severe impact on Alfred's ability to operate normally.

 

Cheers,

Andrew

Link to comment
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...