Opening a pile of urls all at once — updated version!

A year or so ago I wrote a post on how to use xargs to open a bunch of urls that were in your clipboard. But it turns out that in newer versions of OS X something broke, deliberately or otherwise, and that method no longer works. Well, it works fine, it’s just *too* fast. So today I needed to check about a hundred urls.. and so it was time to fix that script. I’ve been slowly working on learning Python, so I decided to use that.. and this is what I ended up with:

#! /usr/bin/python
import webbrowser
import pyperclip
import time
url_list = pyperclip.paste()
clean_list = url_list.splitlines(False)
for x in clean_list:

    webbrowser.open(x)
    time.sleep(.5)

It only took me about an hour 😉

What does it do? It grabs the clipboard, splits each line inside the clipboard at the return character, and then there is a loop which tells the browser to open the url .. wait a half second and then do it again.

I’d like to figure out how to grab the clipboard and clean it in one line.. but that’s for another day!

Back to work..

Open a pile of links in browser tabs, all at once!

One of things I occasionally do at work is to grab every url for a client’s domains/sites and open them up to eyeball them and see if anything obvious needs fixing.

First I go and copy a list of all the active domains, and clean it up with a “search and replace” script. I end up with a list of url’s, one per line.

After that I copy it all and go over to the Terminal and run a nice little script which I call “tab”. My current default browser then starts sprouting tabs galore.

Here’s the script:


#!/bin/bash
pbpaste | tr "\r" "\n" | xargs -n 1 open

How does it work?

pbpaste provides the contents of the clipboard to the command line (see pbcopy to put things into the clipboard). tr translates characters, in this case from one kind of line end (or return character) to another. An issue with pbcopy from what I can tell! Then the cleaned up clipboard gets pushed to xargs which take the command -n 1 open and builds one open per line of data being fed to it. Yes, xargs is very cool. The open command will then “open the URL in the default browser”.

I am sure this can all be done in Applescript or Automator.. but typing tab and return on the command line is the fastest and simplest for me!

If you want to use the script and are not sure how to take the shell code above and turn it into an actual script.. let me know and i’ll provide instructions (gee, another blog post!).

Using Adobe Acrobat to view PDF’s in Safari 5.1.x and Mac OS X 10.6.8

Safari no longer displays PDF files.. and hasn’t done so on my machine for months. It does not bother me much, as I prefer to download them anyway, by clicking in the URL bar and then holding option and then hitting return, which downloads them.

But a client called and complained that they needed to be able to fill in online pdf forms, and when they clicked the link all they got was a black screen, so I went and figured it out:

On Mac OS X 10.6.8 with up to date versions of Safari, you need to make sure that Safari is running in 64 bit mode for the Acrobat reader plugin to work.

To get it to do so, quit Safari, go to it in your applications folder, right click on Safari and Get Info. Empty the checkbox that says “Open in 32 bit mode”. Launch Safari, and viewing PDF’s in Safari with Acrobat Reader will now work.

You can also run into problems if you have Acrobat Reader and Acrobat Pro installed, any updates to the Pro version may mess up your browser plugins. To fix this you need to delete the plugins and reinstall Acrobat Reader.

The AdobePDFViewer plug-in is used to display PDF files in Safari using Acrobat and Reader. This plug-in is installed as part of the Acrobat X or Reader X installation. The location of this plug-in is:

Macintosh HD/Library/Internet Plug-ins/AdobePDFViewer.plugin

Details are from Adobe’s Help page: Troubleshoot Safari Plug-in

To remove the plugin: Quit Safari, then go and delete the plugin. Yes there’s a second one, called AdobePDFViewerNPAPI.plugin, you can ignore it.

Then reinstall the latest version of Acrobat reader. You can find various installers on Adobe’s Acrobat Reader Download Page.

I should also mention: if you have need to use Acrobat Reader to view PDF’s in Safari and would prefer to use the built in viewer, just go and delete both the plugins mentioned above and then restart Safari.

Giving Marketcircle my 2 cents!

The fine folks at Marketcircle, makers of the amazing Mac CRM, Daylite, and invoicing application, Billings, have got people riled up by a recent blog posting of theirs.

We (that’s not a Royal we, that’s myself and a few other folks I know who use their products) have always been frustrated with the Report Engine and the difficulty in customizing invoices and reports in it.

Anyhow, the blog post is here: Stop InDesign Invoicing – Templates Aren’t Enough, and a pile of comments follow it…

My 2 cents?

Dave says:

I know WTL and what he is not saying is that he is a designer and programmer.. and if he thinks the invoice designer needs to be “burned to the ground and rewritten” you’ve got a serious problem!

I’m a consultant, and when clients come to me asking about Invoices, templates, reports, etc in Daylite and Billings, I just shake my head. Not worth the headache, and I have had lots of time to try to figure it out, I have been using Billings since 2006.

So Marketcircle? Go look at Filemaker and see that a super powerful system can be made friendly, and we can all actually use it. I’m sure you can build a layer on top of the designer that would let us do what we want, or even a separate application.

While we’re at it, can we get PDF invoices from Billings Touch? And not these mobile invoices, please follow the numbering in the main app! It’s ok to check out a few invoice numbers when we sync and hold onto them in BT until we sync back. HTML invoices make me look bad. My clients want PDFs!

I recommend Billings to my clients. Keep it up, you’ve got fantastic products that really should only get better!

I’d love to know what you use for invoicing and time tracking.. drop me a line at dave at theconsultant dot net

On Steve Jobs dieing…

I think Apple said it best, in their Think Different campaign:

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.

The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them.

About the only thing you can’t do is ignore them. Because they change things. They invent. They imagine. They heal. They explore.

They create. They inspire. They push the human race forward.

Maybe they have to be crazy.

How else can you stare at an empty canvas and see a work of art? Or sit in silence and hear a song that’s never been written? Or gaze at a red planet and see a laboratory on wheels?

We make tools for these kinds of people.

While some see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.

Wish list for iPhoto: Make Faces Smarter!

Ever used iPhoto and thought to yourself “I wish it did…”, well I just installed the new iLife ’11, which includes iPhoto 9.

I decided to play around with Faces, and update a few photos… not exactly the quickest process! Anyhow, I found a tip to speed things up: make a smart folder which shows “Face is unnamed”. Now you can go in and name faces, and once you do it jumps to the next photo. You can use tab to goto the next name field in a photo (or shift-tab to go backwards) put the name in, hit enter and it will goto the next photo. I have also been deleting face fields where I do not want to deal with identifying people.

So what is my wish? Simple: if the photo is dated before the birth date of a person in your Address book, then do not show that name.

Yes I could type it in manually, but don’t show it as an autofill option. It would make filling names in so much easier for me.

Ok, ok. I’m biased, both of my kids names start with a J!

I’m guessing the opposite would be useful as well, for someone who has passed away. Mind you Address Book does not have a field for that!

Have you found any tricks to make using Faces easier?

Bringing up your Mac’s Color Picker anywhere!

I was wandering through Smoking Apples earlier today, and ran across their article: Deconstructing the Mac OS X Color Picker. Now, honestly, I do not use it very often.. but it is a very useful tool to keep track of a few favorite colors, and an easy way to pickup new colors from something else on your screen.

They also mention a few plugins, one of which I am going to grab ASAP: a hexadecimal color picker, which you can use to get color values for use in your web pages.

Last, and not least, is the super simple way to open the picker from anywhere! Make a new script in your Script Editor and type in ‘choose color’ and save the script as an application. When you run it up comes the color picker! Feeling too lazy to open Script Editor? The folks at Smoking Apples made the script and put a nice icon on it already. It’s in their article.

Thanks guys!

Archiving selected emails to a single file.

I needed to gather about 50 emails into a single file so I could sift through them and pull out a variety of information. Going through them one at a time in Mail was going to take longer than I wanted, or was willing to do at once, so I decided to save them to a single file so I could do it later.

It turns out to be very simple: you select the relevant emails, in my case the result of a search, and do a “Save As..”. At this point you have a choice of how to save them, and I chose the default “Rich text Format”. I ended up with one file with all 58 emails in it.

Now I can open it in TextEdit and delete the parts I don’t want.

How to run the same application more than once!

I spotted this trick on macosxhints.com: An easy way to run multiple instances of any program

Apple’s Developer Resources has a copy of the man page for open and explains it like this:

-n  Open a new instance of the application(s) even if one is already running.

So what can you do with it, and why?

I had no real use for it until this morning when I wanted to test the CPU load on Safari of a web site, without having to close all my windows and their tabs. So I fired up the terminal and did;


open -n /Applications/Safari.app

… and then there were two Safari icons in my Dock!

The MacOSXHints article warns that there is some danger having multiple copies of an application open, as they will all be trying to read/write to shared files like preferences.

Let me know if you have any cool uses for it!

“Introduction to Mac” Workshop coming up on January 26th

I will only quote part of the announcement regarding the Workshop Tom and I are offering next weekend… all the details are on Tom’s site: Introduction to Mac course, in Ottawa, Ontario, on January 26th, 2008.

As you can guess from the course title, we will be doing an introduction to the Mac, from the outside in!

Some of the major applications which will be covered include; Mail, Safari, Address Book, iCal, iChat, and the iLife suite of applications. There will be time at the end to address specific questions, which we expect will arise!

As Tom says:

Now that the details are (finally) worked out, I can safely announce that Dave Rostenne and I are offering our first combined course for users who are new to Macs, or have just "switched". The course will take place over at the School of the Photographic Arts: Ottawa (SPAO), and you can find details on their special events page or in this printable PDF file.

When

Saturday, January 26th, 2008 from 1:00 PM to 4:00 PM, with an additional hour afterwards (4:00 PM to 5:00 PM) for questions and answers.

The cost and how to register

The cost is a very reasonable $79, and to register, you can either call (613) 562-3824 or email ADMIN@SPAO.CA. Register soon, because seating is limited to 20 people!

We hope to see you there!