Archive for category OS X

Resizing An Image Without An Image Editor — Using Automator

This is a fast and easy way to scale the size of an image (or a bunch of images) using OS X’s built in utility Automator.  It is very simple (also crude), but it works and the results are pretty decent.

(You can scroll down to the end of the post if you just want the Automator applications and don’t care how I got there.)

First set up the job in Automator by opening the application in /Applications:

Automator Location

Automator Location

Next, choose workflow from the opening screen and select choose (or just hit enter if they’re already highlighted):

Automator Template Chooser

Automator Template Chooser

The next screen has built in functions to select by category.  In the first column, select “Files & Folders“.  Column 2′s selections are based upon what you select in column 1.  Now the next additions to your workflow will depend upon your desired task.  If you’d like to convert a single image, or if you plan on converting a bunch of images in a folder.

First we’ll cover how to make a simple workflow that you can use to select one image, start the workflow, and exit Automator.

With “Files & Folders“ selected in the first column, drag “Get Selected Finder Items“, followed by “Copy Finder Items” into the right hand area.

Next, in the first column, select Photos.  Find “Scale Images” and drag that to the right hand actions area, so it is at the bottom.  Your workflow should look like this:

Workflow to Scale a Selected Image

Workflow to Scale a Selected Image

Next, we want to adjust an options on  ”Copy Finder Items” and “Scale Images”  to force the workflow to ask for a values, rather than having to manually open Automator, change them, and click “Run”.  That Would be tedious, and we are looking for simple.  So, click the options button in the “Copy Finder Items” and ”Scale Images” portions of your workflow, and click the check box “Show This Action When Workflow Runs” in both of them:

Setting Automator To Ask For Values

Setting Automator To Ask For Values

With that done, just use the “Save As” in the file menu (⇧⌘S) and save the file as an application:

Save Automator Workflow As Application

Save Automator Workflow As Application

That’s it, really.  You can now drag an image file onto the new application, it will ask you where to save the resized image, as well as ask you for the type of scale.  You can set by percentage, or by pixels, and set the value based upon how you chose to scale it.  Scaling by pixels appears to be based upon the width, and then uses the same scale factor to the height automatically.

Now, you can adjust this application to do a whole batch of files inside a folder, if you’d like.  First, open Automator, click “Open Existing Workflow”, and choose your new application created above.  Drag “Get Folder Contents” and place it under “Get Selected Finder Items” in the workflow.  Your new workflow should look like this:

Workflow To Scale A Folder Of Images

Workflow To Scale A Folder Of Images

Again, click “Save As” in the file menu, and select a new name for this application.  You can now drag a folder of images and drop it on the application to resize a batch of images.

There are other options in the Photos section of the Library of actions (the left hand column) such as changing the file type as well, for instance if you have a bunch of jpg’s and want to make them png’s for the web.

I hope this gets you interested in Automator–a totally useful and underrated tool–and happy image scaling!

Download the Single File Application or the Folder of Images Application here if you’d like. You can update and change them by opening them with Automator.

, , , , , , , , , , , , , , , ,

No Comments

Simple Introduction To Apple’s Unix Using Terminal on OS X

This post is for someone interested in learning UNIX on Mac OS X Snow Leopard, but lacks experience using a command line, or has only C:\ prompt knowledge. I will show you, simply, how to map a DOS command to a UNIX command, and to save your profile so the alias name you create is persistent.  If you are a shell scripting genius, this post is something you are encouraged to comment on and expand upon, as learning scripts and commands for OS X can be input many different ways.  It never hurts to have different suggestions.  I will try to make this at the minimum a weekly edition to my blog, and expand each article further than the next.

Let’s get started.  First, open Terminal from your /username/Applications/Utilities folder. This is the command line utility for UNIX, by default it is Bash (Bourne Again Shell.)

You will see your entire present working directory prior to the $ prompt.  The tilde (~) represents /Users/your home folder.  The standard format is computer name: pwd. You can type the simple command pwd and the shell will respond with the folder you are currently accessing.

Default Shell

Default Shell

I like a cleaner shell screen, so I type bash, and hit enter.  This opens a new bash shell, on top of the existing shell.  Next, the command clear deletes the current Terminal text and starts with a fresh bash prompt.  You end up with a Terminal screen that looks like this:

Clean Bash Prompt

Clean Bash Prompt

Here, we can start by showing the man (short for manual;  built in UNIX help pages) page for the command ls (list), which is basically the dir command in DOS.  Simply type man ls at the command line and hit enter.  You can move down the pages line by line using the down arrow key on your keyboard.  To exit the manual, simply type q.

The man page shows you the various options you can use along with the ls command, for example, ls -lia. This command is particularly useful when searching a directory for hidden files (they start with a period), as Finder refuses to display them by default:

Directory Listing With Hidden Files

Directory Listing With Hidden Files

Now, if you are used to DOS, here is a helpful way to stick with the commands you know, yet tell Terminal to run UNIX commands.  You create an alias, basically a command name you make up mapped to a system command. If you want to use options such as -lia, you need to enclose the command in double quotes.  The syntax of the alias command in bash is alias newCmdName=systemCmdName. The command in DOS for a directory listing like the one above is dir /a.  So we can map dirA to ls -lia like so:  alias dirA=”ls -lia”

Note that UNIX is also case-sensitive, for files as well as commands:

Alias DOS dir to UNIX ls

Alias DOS dir to UNIX ls

You can simplify entering commands by using the up arrow to cycle through previously typed in commands.  The history command, saves the commands you enter by line number, which you can view by typing history.  To execute the line number, type an exclamation point followed by the line number:

History Command

History Command

Now, to save this new alias dirA you created into your bash profile.  This way it doesn’t get erased when we kill the shell and quit Terminal.  You may not have a profile set up for bash in your home directory, so what you need to do is create one.  Bash will look for .bash_profile first, so it is best to name any profile you want to use on a regular basis with this name.  It is a hidden file, so you need to have the period in the file name.  For simplicity, you can create a simple text file in your favorite text editor, name it bash_profile (without an extension)and save it in your home directory.  Write the exact command on one line like so: alias dirA=”ls-lia”

Save the file, and then change the name in Terminal.  Use the command mv to change the name so it begins with a period.  Simply type mv bash_profile .bash_profile and press enter:

MV Command

MV Command

MV Complete

MV Complete

That did two things:  one, you moved the file;  two, you learned that mv is the same command as the DOS command move.  You can follow the procedure above to make an alias for the mv command, and place it on the next line in your .bash_profile, so it remains permanent for your login shell.  If you like running an “non-login” shell as I do above, you can use the command cp to copy your .bash_profile to .bashrc like so:   cp .bash_profile .bashrc

Here is a short list of a few DOS commands, along with their respective UNIX bash counterparts (pdf of list here):

DOS COMMAND

UNIX COMMAND

DIR

LS

MOVE

MV

COPY

CP

FIND

GREP, FGREP, EGREP

MEM

TOP (virtual memory use VM_STAT)

*use ctrl-c to end TOP command*

CD

CD (PWD to display current directory)

DEL

RM

That’s all for this quick lesson.  Stop by next week for more DOS examples in UNIX, and (hopefully) working with vi, UNIX’s text editor.

, , , , , , , , , , , ,

1 Comment

Typing Special (Unicode) Characters in Snow Leopard

[You can find the hex code for common symbols here if you already set up your Unicode Keyboard layout. ]

Wondering how to make special characters, such as the Command (⌘) Symbol in OS X Snow Leopard?  Maybe you want to add the Euro (€) symbol? It’s not as hard as you may think.  They are Unicode characters, and there are a few simple steps to make them easy to type on screen.

System Preferences Window

System Preferences Window

First, open System Preferences.  I like to use LaunchBar, so I type ^Tab, press”sy”, and hit enter.  For those of you who like the mouse (gasp!):  System Preferences is in your dock by default, or it’s found in your Applications folder.

Once there, click the flag icon “Language & Text”.  Next, click “Input Sources”:

Input Sources Tab

Input Sources Tab

Scroll down until you find Unicode Hex Input, and check the box.  I also like to have the option shown in my menu bar by the clock, so I leave the “Show Input menu in menu bar” box ticked:

Unicode Hex and US Layouts Checked

Unicode Hex and US Layouts Checked

In the same window, click the “Keyboard Shortcuts” button.  In the next window, click “Keyboard & Text Input”:

Keyboard & Text Input

Keyboard & Text Input

Here is where you decide how to switch between your normal keyboard and the Unicode Hex keyboard layout. The options are called “Select the previous input source” and “Select next source in Input menu”.  To change the option, click where the keys are to the right of the name of the shortcut, select all of the keys in the box, and then input your new keystrokes.  I chose to hold down Control, Option, Command, and Space Bar (daunting I know.)

Holding down your shortcut gives you this window where you can arrow key through your options:

On-screen Input Selector

On-screen Input Selector

The key difference between Unicode and US is the function of the option key.  In Unicode layout, you hold down the option key and enter the Hex code for the symbol you’d like to type on screen.  For example, holding down option and pressing 2 in a US keyboard layout gives you the trademark symbol, ™.  Whereas in the Unicode Hex layout, you need to hold down option and type four keystokes to make a symbol.  ⌘ is Option and then 2318.

To find the Unicode “code” for your symbol, open the Character Viewer by pressing option-command-T (⌥⌘T) or by clicking the flag near your clock in the menu bar, and then clicking on Show Character Viewer:

Input Menu

Input Menu

Looking at the Character Viewer (⌥⌘T), you can attempt to find your symbol with the search field at the bottom.  Clicking on a symbol will tell you which four keys to type while holding down option (and being in the U+ keyboard layout):

HexCode Location

HexCode Location

I chose the Euro as an example, and you can see in order to type the symbol, I hold down option and press 20ac (caps not necessary, although it is shown that way): €.

The keyboard viewer also helps identify the keymap of a new language layout. Although there isn’t a noticeable change between US and Unicode, you may see quite a change picking something like Canadian French or Dvorak.

Hex Keyboard Layout

Hex Keyboard Layout

Good luck and happy character typing!

PS– To type the apple () symbol, in a US keyboard layout, hold down Option+Shift, and press k. No special keyboard required!

, , , , , , , , , , , , , , ,

1 Comment

LaunchBar, Quicksilver (OS X) or Colibri (Windows)

Apple’s notebook line has been selling like wild for quite some time now, and I think it’s appropriate for notebook users to know about these programs.  Even desktop users should have them, but there is literally no excuse for a laptop jockey to forego them.  My wife, a vested Windows laptop user, has the option of Colibri.  These programs are interchangeable in what they do for the most part, so I’ll just go ahead and write about them as a group.

They are all handy little applications that index your files, programs, webpages and such so they are no more than a keyboard shortcut away.  I cannot stress enough how much time and effort these programs save.  They remove the tedious movements and tendon crippling one-finger clicking a mouse can produce.  They save you countless hours per week of navigating through the Finder or Start Menu.  You can launch pretty much any application within three keystrokes, which for  a notebook user is indispensable.  Imagine sitting on a plane and not missing your mouse.  You can open songs, albums, files, pictures, you name it and it’s indexed.

LaunchBar has been my application of choice since I was on Panther, so I am a bit biased towards that one in particular. The downside is a license will cost you roughly  €24.  Quicksilver and Colibri are both free licenses at the time of this writing.

I’ll let you decide which is right for you, but be warned: this is like going from dial-up to broadband.  You get the good stuff and you’ll never live without it again.  So for those choices that are donationware, I strongly suggest you keep their development teams happy and throw them some coin.

Here’s the links:

QuickSilver

QuickSilver

Launchbar

Launchbar

Colibri

Colibri

As I said, I’m a huge proponent of LaunchBar, they give free updates, and have one of the fastest interfaces on the planet.  See below for screenshots of the preferences panels, and if that isn’t enough go ahead and click on the link above and download the free trial.  You won’t be sorry!

General

General

Appearance

Appearance

Shortcuts

Shortcuts

Actions

Actions

lb5

Calculator

Clipboard

Clipboard

Advanced Options

Advanced Options

, , , , , , , ,

No Comments

Problems with OS X? Have you repaired your permissions?

Funny things, those permissions.  Similar to the Registry of Windows in a couple of ways.  If it gets out of whack, your computer acts bizarre, or just doesn’t act at all.  Also, if you install and remove programs frequently, the likelihood of your registry (in OS X’s case–permissions) have a greater chance of getting screwed up.  The similarity really stops there.

Permissions in OS X are the default values for the system’s read/write/execute access, meaning who has “permission” to read a file, write to a file, and/or make it run.  If these permissions somehow get incorrectly set, you as a user of the computer may run into problems trying to perform one of those actions.

Lots of things can happen when your permissions get messed up.  Some programs, like iTunes, may not authorize to your account.  Sometimes disks or drives won’t mount.  Some programs may not even start, let alone give you an error.  The permissions set up on OS X can easily be repaired, however, so don’t panic.

It is always a good idea after installing or removing a program to repair your permissions with OS X’s built in Disk Utility application; it’s found in /Applications/Utilities/Disk Utility (this is true since OS 10.2, Jaguar.)  For the directorily challenged:

Disk Utility on Hard Disk

Disk Utility on Hard Disk

Once you have found it, open it up and select your hard drive on the left.  Then at the bottom of the page, click “Repair Disk Permissions”.  This may take a little while if you’ve never done it, but usually less than 10 minutes in my experience (even on my PPC G4.)

Here are screen shots before and after on my MacBook Pro:

Disk Utility "First Aid" Tab

Disk Utility "First Aid" Tab

Disk Utility Repair Complete

Disk Utility Repair Complete

This repair took 2m:34s to complete, on my 2.4Ghz Mid-2008 MacBook Pro, 4GB of RAM.  Not too bad at all, and my permissions aren’t in that bad of shape.  You will notice there are two things in the list, and they will not be repaired.  When this happens, it is always a good idea to check out Apple’s Knowledge Base , if for nothing else than peace of mind.

Every couple months or so, for an average web surfer/emailer, it’s probably a good idea to run the Disk Utility found on your installation disks (assuming they are the version of OS X you have installed, of course.)  This is especially helpful to have if you run into serious problems, as you don’t need to rely on the hard disk to boot in order to run your permissions check.  If it is that bad, you may want to Verify the disk as well, as that checks the actual drive itself for errors, not just a file structure problem.

, , , , , , , , ,

No Comments

Downloading and Installing Applications on OS X

If you are a new Mac user, switching from Windows, or just new to computers in general, you may not know there is something a little bit different in the way you install programs on Mac OS X.
Many people I know run into trouble installing applications they download from the internet, simply because they are not used to dropping an application into the “Applications” folder from a mounted virtual disk. My brother had 4 copies of Google Earth downloaded, none installed, and wondered why it was “reset” every time he tried to run it. So, for those of you out there trying to figure out why you cannot just drag the icon into the dock and run it at will, here is a tutorial made just for you.

First, download your application. In OS X, on Safari, the default location for your downloads is in your “Downloads” folder, located inside your “Home” folder. To access this location, find “Finder” on the left hand side of your dock (by default.) It looks like this:

Finder

Finder

When you click on the icon in the dock it will open a new Finder window.  You can accomplish this same task by holding down ⌘ and hitting N, or “Command-N”. Be sure it says “Finder” by the  in the menu bar, upper left hand corner of your screen.  You should see something similar to this:

New Finder Window

New Finder Window

I am currently running OS 10.6.1, Snow Leopard, but the above ⌘-N works throughout OS X.  Also, I have already clicked on the “Home” folder (looks like a house) and the Downloads folder inside of Home.  That is why they are highlighted in blue.  If you do not have this view enabled, it may look like this:

Cover Flow View in Finder

Cover Flow View in Finder

You can see the top center of the window shows my Home Folder, meaning this is the directory you are currently located in.  You can use your arrow keys to navigate down the list shown in the bottom half of the window until you get to the “Downloads” folder.  Hitting enter, however, will not get you into that folder.  You can use ⌘-Down Arrow to go into the folder, or you can use ⌘-Right Arrow to open the folder’s contents and display it in the list.  As a matter of fact, when you select any file and want to open it, using ⌘-Dn (I’ll list command-down arrow like ⌘-Dn from now on) will work.  You can also hit spacebar to see a QuickView of the file.  Yet, I digress.

So, now that you are in your “Downloads” folder, you can find the file you have recently downloaded.  I will use Google Earth as my example here:

Google Earth Download Page

Google Earth Download Page

When you click the “Agree and Download” button, you see a new “Downloads” window open, and the file begin to transfer to your computer:

File Transfer In Progress

File Transfer In Progress

After the file transfer completes, a bunch of stuff happens.  First, OS X verifies the disk image is not corrupted, and then it will mount.  A file with “dmg” after the period means “Disk Image”, which basically means it is just like a CD or DVD you would put into your drive.  If you had a physical disk and stuck it in your DVD drive, it would show up on your desktop, and you could click on it.  Same goes for .dmg files, but you don’t need the physical disk:

Google Earth Downloaded and "Mounted"

Google Earth Downloaded and "Mounted"

The download automatically verifies, and “mounts” on your desktop, just like you had a Google Earth CD and put it in your drive.  The white thing above the disk name on my desktop there is the icon for a virtual disk, or some USB drives as well.

You can also see the actual Google Earth application in the window titled Google Earth and the virtual disk picture just to the left of it.  If you close that window, the disk stays mounted on your desktop.  What you want to do now is actually install the program by dragging it to somewhere on your computer.  This is done simply by holding down the left mouse button (trackpad button, or sometimes your only mouse button) and moving it off of the window it is currently in.

I recommend always installing programs into your “Applications” folder, to keep everything nice and tidy.  Open a new “Finder” window, and below your home folder it says “Applications”. Click on the link, and it will open your “Applications” folder to the right hand side:

Installing into Applications Folder

Installing into Applications Folder

One thing to note here is above the “Applications” link, there is the Google Earth disk image with an Eject symbol next to it.  More on that in a second, first let’s install Google Earth. Get your two windows side-by-side on your desktop, and drag the Google Earth application from it’s current window and drop it on the list in the “Applications” window.  Before you let go of the mouse button, be sure there is a little green “+” sign, letting you know the file you are moving is going to be copied into this location.  If you see it, go ahead and drop it in there:

Side-by-Side

Side-by-Side

Look for the + Sign :)

Look for the + Sign :)

Now that you have installed and application, you can unmount the disk image.  First, close the window titled “GoogleEarth-Mac”.  Next you can either click the eject button next to the GoogleEarth disk in the “Applications” window you still have open, or you can click once on the disk image on your desktop to highlight it.  You can then drag it to the trash can in the dock (with turns into a big Eject button), or you can use the keyboard shortcut ⌘-E (command-e for  ”e”-ject.)

Lastly, if you want to back up your GoogleEarthMac.dmg file, you can do so.  You can leave it in your “Downloads” folder, or you can delete it.  To delete it, navigate back to your “Downloads” folder, in your home directory, and highlight the .dmg file:

Highlight the File in Finder

Highlight the File in Finder

To send it to the Trash, simply drag it there and let go, or hit ⌘-Delete.

That’s all there is to installing an application on OS X.  Once you can effortlessly find your way around the windows, installing is as easy as drag and drop!

, , , , , , , ,

No Comments

Safari and Firefox Cache Preferences

I have a MacBook Pro, and I’m always trying to keep it running the best that it can.  Most of the time, the trouble I have is related to the amount of space Safari and Firefox use to store files in the cache.  If you would like to limit Safari’s space on your hard disk, you are kind of stuck as far as the options in the file menu’s “Reset Safari”  go.

In order to reset ( or clear ) your cache, history, cookies, etc., you can easily do this by clicking Safari in the menu bar, and either selecting just “Empty Cache” or “Reset Safari” from the drop-down menu.  There is a lot of options in Reset Safari, and you can partially clear certain things as you like.

You may also be interested in limiting the actual size of the cache, of which you have but one option–WebPreview, or CoverFlow.  You can check here for instructions on how to disable that feature. Unfortunately, there is no option in Preferences to limit the cache size of Safari, or if there is I couldn’t find it.  There is a cryptic “database size” option in the advanced section of preferences, and I am trying to find out from Apple what that is in reference to (as I have none listed in the box.) The “Database Size” in the advanced section of Preferences has been an option to JavaScript developers to store code client-side rather than server-side as a way to avoid code getting trashed by storing it with a user’s cookies.  Unfortunately, after my call with Apple, there is no way to limit the size of the Cache.db file yourself (from Apple directly.)  They did mention that there “may be a third party”  application out there that could do this for me, of which I will have to scour the intrawebs to find.  My cache.db is 180MB after only two days of having cleared it.  Bummer.

Firefox, on the other hand, does give you the option to limit the cache size in Preferences –> Advanced –> Network:

Firefox Preferences

Firefox Preferences

This is nice to have, and the default is a modest 50MB.  I’ve had Safari’s WebPreview images top 500MB, which is just out of hand.

Firefox also has the ability to start sessions and save information as you’d like, found under Preferences–>Security:

Custom Security Settings

Custom Security Settings

Private Browsing Option

Private Browsing Option

The private browsing feature should show in your window’s title bar letting you know it is activated.  With this feature enabled, you just aren’t saving anything to your cache, history etc.  You are not surfing the web anonymously, however, so don’t do things you wouldn’t normally do!

, , , , , , , , , , ,

No Comments

iTunes Add Music Automatically from Any Folder

I’ve read a lot of posts saying Apple has no way in iTunes to automatically import music from any folder you put files into. Also, an equal number complaining there is only one folder now, in iTunes 9.

Here is a quick and easy way using Automator in OS X to do it yourself.  In about forty-five hot and dirty seconds, you can create a folder action with Automator to monitor the addition of new music files for you. This folder will automatically add the new files to iTunes, convert them, and even remove the added files from the import folders. (Scroll to the end of the post for the workflow file, if you’re in a rush.)
First, open Automator. Click the Folder Actions icon:

Automator Folder Action

Automator Folder Action

In the next window, in the upper-right, find the drop down menu, choose a folder to receive the import action:

Folder Drop Down

Folder Drop Down

If you don’t have a folder created already, then just choose “Other” and in the next window you’ll be able to make one.  If you do, choose “Other” and select your pre-made folder.

Next, find “Music” on the left hand column, followed by “Import Audio Files” in the right-hand column.  You drag the “Import Audio Files” to the large gray area to the right, and choose an encoder for your import.  See screen shots below:


automatorSS4
automatorSS5That’s about all for the import.  Click “File”, then “Save As”, and pick a name for your Action.

You could stop there, but you will end up with re-imports of your files as they aren’t deleted automatically on import to iTunes.  So, the logical thing to do is let the folder delete them for you, by again using Automator’s built in actions. To do that, just select the “Delete Source Files After Encoding” checkbox:

autoSS1

Be sure to save your workflow, and you should be ready to import your music automatically using iTunes from whichever  folder you chose.  Still waiting on Apple for a video option, but iTunes has never been the best when it comes to playing nice with things like other’s video codecs.

In order to add this to another folder without going through Automator is easy.  Just right click (or control click blech…)the folder you want to create the action on, and choose “Folder Actions Setup” in the list.  It will open a list of actions for you to choose, and you will find your iTunes import action there under the name you saved it as.  Select it, and you have just added it to another folder, and kept it alive on the original to boot.  Beautiful.

folderactionsSS1importSS1importSS2

importSS3

If that was too much for you to handle, you can just download the workflow right here. Save this file to ~/Users/yourusername/Library/Workflows/Applications/Folder Actions (if the folder doesn’t exist, you may have to create it), and you should be good to go!

, , , , , , , ,

2 Comments

Update to Safari CoverFlow Webpage Preview

Ok, a quick fix if you hate CoverFlow in Safari 4 is to make the ~/Library/Caches/com.apple.Safari/Webpage Previews folder read-only like so:
Navigate to the folder, and select it. Hit Command-I.
At the bottom of the info pane, to the right of your name (Me), click where it says “Read and Write”, and change it to “Read-Only”. See screen shot below:
Disable Write For CoverFlow Webpage Preview Folder
This doesn’t disable CoverFlow altogether, but at least it isn’t chewing up almost 50MB of disk space when you browse 10-12 websites. I guess Apple could have made them .tiff files and really screwed the pooch. I know I’ll be keeping this read-only until they make CoverFlow a choice in Safari.

, , , , , , , , , , ,

2 Comments