Archive for category Mac OS X

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!

No Comments

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.

No Comments

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!).

No Comments

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!

No Comments

“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!

No Comments

AppleScript 2.0!

Thanks to df for pointing out that Apple has posted release notes for AppleScript in Leopard.We can now ask if an application is running, without AppleScript launching it to find out. ;-)Some nice additions to running AppleScript on the Command Line:

  • use # to comment out a line
  • start the script with #!/usr/bin/osascript, and make it executable, will enable it to be run in the shell
  • osadecompile is a command line script to display compiled scripts as text

Now osascript also supports additional arguments on the command line, so now you can run a script and provide strings for it to use. see the osascript man page for details, and an example. This feature was available in Tiger, I just never noticed until now!

No Comments

StuffIT download

StuffIT, that became Allume, that became digital river is becoming less and less relevant on Mac OS platform. Part of the reason for that, of course, is the policy of the manufacturer, that requires signing up, buying things, etc. It’s nearly impossible to find the free StuffIT expander, for those rare moments when you need it.

In any event, here is a direct link to the StuffIT download page. I had to give out a throw-away e-mail address to get it.

2 Comments

Today’s Cool Key Command!

Select a word, do command-ctrl-d, and it invokes pop-up window with data from the dictionary. Thanks Tom!

No Comments

Merging Keychains?

Does anyone know how to merge multiple Keychains in Mac OS X?

I know I can copy items from one keychain to another, but that involves authenticating twice.

I tried going in and adding those other keychains to be part of my list, but they don’t stay. Frustrating.

Why am I doing this? I replaced my computer, and was not able to transfer my account at setup time, so I ended up with some old keychains that got copied over.

Suggestions, comments, rants?

All are welcome!

Dave

1 Comment

Mac OS X/mach: Identifying architecture and CPU type

Platform independent endinanness check:

#include <stdio.h>
union foo
{
  char p[4];
  int k;
};

int main()
{
  int j;
  union foo bar;
  printf("$Id: endianness.c,v 1.1 2006/07/09 17:48:14 stany Exp stany $\nChecks endianness of your platform\n");
  printf("Bigendian platform (ie Mac OS X PPC) would return \"abcd\"\n");
  printf("Littleendian platform (ie Linux x86) would return \"dcba\"\n");
  printf("Your platform returned ");
  bar.k = 0x61626364;
  for(j=0; j<4 ; j++)
  {
  printf("%c",bar.p[j]);
  }

  printf("\n");
  return 0;

}

Platform dependent tell me everything check:

/*
 * $Id: cpuid.c,v 1.2 2002/08/03 23:38:39 stany Exp stany $
 */

#include <mach-o/arch.h>
#include <stdio.h>

const char *byte_order_strings[]  = {
        "Unknown",
        "Little Endian",
        "Big Endian",
};

int main() {

  const NXArchInfo *p=NXGetLocalArchInfo();
  printf("$Id: cpuid.c,v 1.2 2002/08/03 23:38:39 stany Exp stany $ \n");
  printf("Identifies Darwin CPU type\n");
  printf("Name: %s\n", p->name);
  printf("Description: %s\n", p->description);
  printf("ByteOrder: %s\n", byte_order_strings[p->byteorder]);
  printf("CPUtype: %d\n", p->cputype);
  printf("CPUSubtype: %d\n\n", p->cpusubtype);
  printf("\nFor scary explanation of what CPUSubtype and CPUtype stand for, \nlook into /usr/include/mach/machine.h\n\n
ppc750\t-\tG3\nppc7400\t-\tslower G4\nppc7450\t-\tfaster G4\nppc970\t-\tG5\n");

return 0;

No Comments