Rule of thirds bookmarklet for Pinterest

I’ve made a quick bookmarklet to be used in Pinterest to superimpose a grid (following the Rule of Thirds) to all images in a Pinterest page

Grab it from jsfiddle.net

Go to Pinterest and click on the saved bookmark… and have fun looking at the photos…

For reference: Rule of Thirds

You can see the effect in the image…

Updated: now it should work also on your Tumblr dashboard!

Posted in Uncategorized | Tagged | Leave a comment

Repeat last command Alfred extension

I thought it could be useful if there was a way to tell Alfred to repeat the last command issued. I know that there is the option to remember the last query (in Appearance->Options you can turn it on).

So I made a little extension that is nothing more than a trick to tell Alfred to repeat last command (having the “Remember the last query” option activated).

After installing this extension (download here) you must create a global hotkey that call it.

I’ve chosen to assign the double tap on CTRL key (for a reason that I’ll explain below)

This extension come in handy used with command like another extension I have made (this one that let you apply a text filter to the selected text in any application – almost any).

Just an example (using the Filter extension):

1) I have a text document and I have to change several word to UPPERCASE – I select the first word and issue a “flt uc” command with Alfred

2) for the other words I only have to select the word and double tap on the CTRL key (the Repeat extension invokes Alfred and tell him to repeat the “fly uc” command)

There are some caveats:

1) the hotkey to invoke Alfred is hardcoded in the source of the extension (maybe there is a way to get it automatically but I had not time to investigate). At this time it’s my Alfred hotkey: OPTION + SPACE – If you have another key combo to invoke it you must change the extension accordingly.

2) the ”Remember the last query” option in Appearance->Options must be activated

3) the extension send a RETURN keystroke to Alfred after invoking it so the command that is executed is the first listed by the last query.

4) the extension wait for a short time for the Alfred window to appear, you can change it and see how it works for you.

5) I’ve chosen to assign a double tap CTRL key combo to the Repeat hotkey because when the applescript of the extension send the keystrokes there must not be other key pressed. Otherwise it does not work.

The last thought is that perhaps it could be handy if there was a “Repeat last command” internal command in Alfred to be assigned directly to a global hotkey. An idea for Andrew…

Posted in OSX | 2 Responses

Use Alfred (almost) as an OSX Service (UPDATED)

I was trying to extend the use of Alfredapp so that it could act on the currently selected text in the frontmost application.

Here is the extension I’ve come out with…. something like a text filter (it can make text UPPERCASE, lowercase, strip HTML tags, expand a Zen coding selector … etc… see below or have a look at the filter.php file in the extension for the options).

You can download the extension here.

It works like this (it’s a mix of applescript and php… perhaps there are other ways to do this but it seems to work now – any suggestion is welcome):

1) You select a text  you want to modify in an application (Textedit for example)

2) You invoke Alfred and the extension downloaded – I called it Filter (flt is the keyword) – like this: flt uc (where uc is the Alfredapp {query})

3) The command  gets the current content of the selection with applescript and write it to a tmp file (/tmp/paste.txt) – issuing a CMD – C with applescript

4) It invoke a php script passing it the parameter (uc in this example)

5) The php script read the text from /tmp/paste.txt and apply the text transform action chosen with the parameter (uc = UPPERCASE)

6) The output from the script is copied to the clipboard with pbcopy terminal command

7) The content of the clipboard is then pasted in the frontmost application taking the place of the current selection

It works almost like a standard OSX system service and it’s easy to add new functionality to the script…

At this time it accepts the following parameters:

uc: UPPERCASE current selection
lc: lowercase current selection
uw: Uppercase All The Words In The Selection
uf: Uppercase first word
st: strip HTML tags
zc: do a ZenCoding expand of the current selection (mainly usefull for web developers… see what ZenCoding is here)

This is a version of the script packed as an Alfred extension… (I made some time ago another one (before Alfred could import/esport extensions) but it is replaced by this)

A warning … being an applescript it’s not so speedy… so it takes some time to work on my machine… your mileage may vary.

PS: the script make use of this class from Philip Walton for Zen Coding expand feature and is inspired by the works of @jdfwarrior (see http://jdfwarrior.tumblr.com/)

Posted in OSX | Leave a comment

Find Lyrics and Set Lyrics in iTunes Alfred extensions

I’ve used several utilities to fill the Lyrics field of my mp3 library with varying results. There are always songs which lyrics are not found.
So I came up with this couple of extensions for Alfred to speed up a bit the process of retrieving lyrics.

There are two extensions:
- Find Lyrics: (fl keyword) which takes care of launching Safari to make a Google search of the track title + artist of the current track playing in iTunes
- Set Lyrics: (sl keyword) this will copy the current content of the clipboard to the Lyrics field for the track that was searched before

You just have to invoke the first extension when you are listening to a song for which you need to get the lyrics, find the right source for the lyrics in Google results, copy the text and invoke the second extension.

These extensions are made with Alfred v0.9.10 which means you have to provide a parameter when calling the extension… any string will do, it is simply ignored. In Alfred 1.0 you’ll be able to call the extensions without parameters. I’ll make an update to the extensions once Alfred 1.0 is out.

Note: The Find Lyrics extension save a txt file in your /tmp directory to have a reference to the current track in iTunes (it uses the database id field to be sure to work on the right track) and the Set Lyrics looks in this file to know where to put the contents.

You can download the extension here (zip file).

Posted in OSX | Tagged , | Leave a comment

Use Spotlight on a remote Mac with the help of Folder Actions and Dropbox (and an Alfred extension too)

I’ve thought often of how much it could be useful to be able to do a Spotlight search on your Mac at home when you are away.
Just for when You need something you forgot to bring with you.

Now I think I’ve found a practical solution.

You need the following things to accomplish the task:

- a Mac from which you want to fetch content (your Mac at home, always on and connected)
- a Dropbox account configured on it

The process is as follows

- on your Mac at home you install the files that are in this zip file. Uncompress it in your Dropbox folder
- download and install this Folder Action workflow (unzip and double click on it)

Now your Mac is ready to receive commands.

All you have to do is to write a file in the spotlightremote/commands folder named as you wish.

Try writing the string “find .doc” without the quotes in a file named find.txt in your ~/Dropbox/spotlightremote/commands folder

After a few seconds you should have a new file created in ~/Dropbox/spotlightremote/output folder, named results.html
It’s an HTML file with the results of the search.

The interesting part is that having the watched folder in your Dropbox You can execute commands from any pc or Mac with Dropbox client on it and also through the Dropbox web interface.

I’ve implemented for now only three commands:

  • find: find files by name (I’ll try to implement more search types in the future) in your home folder (ex: find .avi)
  • preview: create a preview of a single file using the QuickLook engine (qlmanage shell command) and put it in the output folder;  need absolute path as a parameter,  you can copy it from the result.html file you got from a find command clicking on the corresponding link.
  • copy: it copies the file you pass as a parameter to the output folder (also need full path of the file as a parameter)

The last thing, to speed things up a little, is an Alfred extension you can use on your other Mac (your laptop or your Mac at work).
Just download and install.
You can invoke it Just like this:

slr find .doc

It will save the command in the right place to trigger the folder action.

Important: the folder action acts only on new files created. You have to first delete your command file and save a new one.  Speed of execution may vary.

Note: it’s an experiment and may not work for you – Use at your own risk – at this time there are no checks on inputs so there are some security concerns to evaluate (if someone gain access to your Dropbox account may have access to all the files in your Mac at home). I’ll Try to improve it in the future. To remove the Folder Action go to ~/Library/WorkflowsApplications/Folder Actions/ and delete the Spotlight Remote.workflow.

Posted in OSX | Leave a comment

Clipboard History joiner extension for Alfred

The Clipboard History in Alfred is a great thing and this extension try to use it for a common task: joining several piece of text copied from different sources.

Its use is simple… just have Clipboard History enabled in Alfred…

An example: you have to copy several pieces of code from an HTML file and they are not contiguos.
Just copy them in the sequence you prefer. They are stored in Alfred’s Clipboard History. Just remember the number of pieces you have copied. Let’s say you copied 3 pieces of code.

All you have to do is to invoke the extension with 3 as the {query} parameter

cj 3

Now you should have in your clipboard the 3 pieces of code joined (in the sequence you copied them) ready to be pasted where you want.

The extension takes care of removing from clipboard history the joined pieces, so if you have chosen the wrong number as a parameter you can try again.

Please don’t blame me for the ugly code, shell coding is not my job… Any suggestion or correction is really appreciated.

Perhaps this could be made in a cleaner way with a Plugin API, but in the meantime you can download the extension here

ATTENTION: this extension is experimental, it access directly Alfred’s  clipboard history db. I’ve tested it only on Leopard and it seems to work correctly. If something goes wrong maybe your clipboard history db may become corrupted.

PS: thanks to @jdfwarrior for his extensions… they are always a source of inspiration (and I’ve borrowed some lines of code from his work, mainly the way to find the path of current user home dir)

Posted in OSX | Tagged , | Leave a comment

FileZilla Alfred extension

I’ve made a simple Alfred extension to open an FTP site in Filezilla. You only need to have it defined in your sites in Filezilla and pass its name as an argument to the extension.

For example if  you have a site whose name in Filezilla is “mywebserver” just call Alfred and write:

fz mywebserver

The extension will open FileZilla and connect to the site.

It uses the parameters you can pass to FileZilla from the command line (see this for details).

You may have to specify the folder where your site reside in in the Filezilla Site Manager.

You can download the extension here.

Link to Alfred website: http://www.alfredapp.com

Link to Alfred extensions page:  http://support.alfredapp.com

Posted in OSX | 2 Responses

Use Alfredapp (almost) as an OSX system service

NOTE: this post is outdated… a new version of it with an Alfred extension ready to be downloaded and used is here

I was trying to extend the use of Alfredapp so that it could act on the currently selected text in the frontmost application.

Here is the Custom Command I’ve come out with…. something like a text filter (it can make text UPPERCASE, lowercase, strip HTML tags, expand a Zen coding selector … etc… see below or have a look at the filter.php file for the options).

You can download the files here. See at the bottom of the article for how to configure it.

It works like this (it’s a mix of applescript and php… perhaps there are other ways to do this but it seems to work now – any suggestion is welcome):

1) You select a text  you want to modify in an application (Textedit for example)

2) You invoke Alfred and the command you have defined – I called it Filter (flt is the keyword) – like this: flt uc (where uc is the Alfredapp {query})

3) The command  gets the current content of the selection with applescript and write it to a tmp file (/tmp/paste.txt)

4) It invoke a php script (filter.php – it must be in the same folder of the command applescript) passing it the parameter (uc in this example)

5) The php script read the text from /tmp/paste.txt and apply the text transform action chosen with the parameter (uc = UPPERCASE)

6) The output from the script is copied to the clipboard with pbcopy terminal command

7) The content of the clipboard is then pasted in the frontmost application taking the place of the current selection

It works almost like a standard OSX system service and it’s easy to add new functionality to the script…

At this time it accepts the following parameters:

uc: UPPERCASE current selection
lc: lowercase current selection
uw: Uppercase All The Words In The Selection
uf: Uppercase first word
st: strip HTML tags
zc: do a ZenCoding expand of the current selection (see what ZenCoding is here)

Configuration in Alfredapp
Unpack the zip file wherever you put your Alfredapp commands (maybe you already have other ones)

Add a command to Alfredapp from the Preferences

osascript <path to where you extracted the zip>/filter.scpt {query}

I’ve named it “filter” with a “flt” keyword. Choose one you like.
Make it silent and test it.

A warning … being an applescript it’s not so speedy… so it takes a few seconds to work on my machine… your mileage may vary.

PS: the script make use of this class from Philip Walton for Zen Coding expand feature and is inspired by the works of @jdfwarrior (see http://jdfwarrior.tumblr.com/)
PPS: a big thank also to the developer of Alfredapp (@preppeller) – I always have so much fun customizing Alfred…

Posted in OSX | Leave a comment

Paste the result of a command in the frontmost application (in Alfredapp)

I’ve made a simple applescript that take care to automatically paste the result of a command set in Alfredapp

I’ll use as an example this command made by @jdfwarrior ( a lorem ipsum generator ) – Install it first.

Download this zip file and extract where you like (an alfredscripts folder in Applications?): paste.scpt

When you setup the lipsum command just add the following text to the command:

; osascript <extracted path>/paste.scpt

Remember to put in also the “;” ….

Issuing the command with Alfred will auto paste the result of the command in the frontmost application.

Posted in OSX | Leave a comment

Two applescript and a workflow for Alfredapp: Find lyrics of the current playing track in iTunes, Set Lyrics of current track, AlfredIgnore

Here are two applescripts that come from a macosxhint.com article:

FindLyrics.scpt: it is an applescript that try to get the lyrics of the current playing track in iTunes (it opens Safari to do a Google Search)

SetLyrics: it gets the current selection in the current window of Safari and put that text in the Lyrics panel of the current track in iTunes

Just put them in the Applications folder (maybe You can make a subfolder – like “alfredscripts” – mine contain also this script from @jdfwarrior – a “Lorem  ipsum sit amet” generator for Alfredapp)

And for who wants to exclude several files or folders from Alfredapp results  there is a little modification of  the workflow described here:

AlfredIgnore.workflow (and the corresponding app): It’s a simple workflow for the finder that asks to set comments for the currently selected files (or folders, recursively) with the “alfred:ignore” string as a default. I have put the app in the finder toolbar as you can see in the pic (just drag the app there).

You can find all the files in this zip: alfredscripts.zip (300KB).

Posted in OSX | Leave a comment