Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

AppleScript to open current Safari page in Google Chrome via LaunchBar or TextExpander Apps
We ran a hint last month about opening the current Safari page in Chrome, but Padraic Renaghan came up with a nice AppleScript that he uses to open the page in Chrome via a LaunchBar action.

property theURL : ""
tell application "Safari"
	set theURL to URL of current tab of window 1
end tell

if appIsRunning("Google Chrome") then
	tell application "Google Chrome"
		if (count of (every window where visible is true)) is greater than 0 then
			-- running with a visible window, ready for new tab
		else
			-- running but no visible window, so create one
			make new window
		end if
	end tell
else
	tell application "Google Chrome"
		-- chrome app not running, so start it
		do shell script "open -a \"Google Chrome\""
	end tell
end if

-- now that we have made sure chrome is running and has a visible
-- window create a new tab in that window
-- and activate it to bring to the front
tell application "Google Chrome"
	tell front window
		make new tab with properties {URL:theURL}
	end tell
	activate
end tell

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning
He got the original idea from another AppleScript to open Chrome via TextExpander , created by Tim Arnold. Here's his script:
property theURL : ""
tell application "Safari"
	set theURL to URL of current tab of window 1
end tell
if appIsRunning("Google Chrome") then
	tell application "Google Chrome"
		make new window
		set URL of active tab of window 0 to theURL
		activate
	end tell
else
	tell application "Google Chrome"
		do shell script "open -a \"Google Chrome\""
		set URL of active tab of window 0 to theURL
		activate
	end tell
end if

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning
With the former, you save the script with any name you want, and type an abbreviation in LaunchBar to activate it. With the second script, you set a TextExpander abbreviation to run the script, and just type the abbreviation. Both of these scripts could be used in other applications: other launchers like LaunchBar, and other snippet expanders like TextExpander, as long as they support AppleScripts. Both are nice ways to quickly open a Safari page in Chrome.
  Post a comment  •  Comments (7)  
  • Currently 3.33 / 5
  You rated: 4 / 5 (6 votes cast)
 
[6,783 views]  View Printable Version
New Poll: The Obligatory Mountain Lion Poll Apps
OS X 10.8 Mountain Lion is due to be released any day now (perhaps tomorrow, according to some rumors). So it's time for the obligatory new OS poll. When will you be installing Mountain Lion? Will you install it at all? Feel free to comment, as usual, with reasons for or against.
  Post a comment  •  Comments (22)  
  • Currently 2.50 / 5
  You rated: 3 / 5 (4 votes cast)
 
[2,895 views]  View Printable Version
Download an unzipped folder from Dropbox's Public folder Apps
Sometimes it is necessary to upload an unzipped folder to Dropbox because some PC users can have problems with opening a file zipped on a Mac. However, you can't make a public link from an unzipped folder in Dropbox.

Here's a solution for creating a link to an unzipped folder that you can send to another user so they can download the folder.
  1. Launch the Dropbox website, from the Dropbox menu in your menu bar, or by logging in to Dropbox in your browser.
  2. Click on the Public Folder; its contents will display in your browser window).
  3. Select the folder for which you want the link; don't click on the folder's name, but to the right of it. The selection will turn blue.
  4. Click the Get Link icon above the folder list. A popup window will appear.
  5. Close the popup window by clicking the x icon in the top-right corner.
  6. In the browser window that is open, click on the folder for which you want the link. The browser window will show the content of your folder.
  7. Copy the link in the address bar and paste it in your e-mail.
  8. Immediately after the pasted URL add: ?dl=1
When the recipients of your e-mail click on the link, a browser window will open and the folder will automatically download into their computer, zipped in a format that even Windows users can open.

[kirkmc adds: This does work. However, it seems like a bit of a workaround. I'd find it a lot easier to simply find a tool that zips archives so Windows users don't have problems. However, if you already have files in your Public folder, this can be a good way to give access to a folder's worth of them.]
  Post a comment  •  Comments (5)  
  • Currently 3.00 / 5
  You rated: 5 / 5 (5 votes cast)
 
[14,598 views]  View Printable Version
Save disk space by deleting Address Book images Apps
I noticed that my ~/Library/Application Support/Address Book folder was pretty big; more than 420 MB. On an SSD, a half a gigabyte is a big hit for something that just records contact information.

So I looked in that folder, and found some interesting sub-folders. First, at the top level, there was a 69 MB "Images" folder, which contains 2,672 items. Second, there was a "Sources" folder, which contained a sub-folder with one of those long names with numbers and letters; presumably my Mac's UUID. In that folder was another Images folder, this one at 345 MB, containing 13,353 items!

So I figured I could try and delete these folders and see what happened. When I re-opened Address Book, the application automatically re-loaded images for many of my contacts. These are contacts for whom I have iChat accounts or Twitter accounts. The new folder is 4 MB, and contains 161 items.

I don't know why the other folders contain so many items, but if your Address Book folder takes up a lot of space, try removing these folders (don't delete them right away, just in case) and see if this slims them down a bit, as it did for me.
  Post a comment  •  Comments (7)  
  • Currently 3.00 / 5
  You rated: 1 / 5 (5 votes cast)
 
[7,207 views]  View Printable Version
Find What's Being Excluded from Backups and Remove Backup Exclusion Metadata Apps
Time Machine uses a specific metadata attribute to know which files and folders not to back up. We had a hint to that effect back in 2005.

It turns out that CrashPlan, the cloud backup service, uses the same metadata to determine what to back up. Macworld's Lex Friedman pointed me to a CrashPlan support article that looks at this, and that shows how to remove the exclusion metadata. To do so, you run the following command in Terminal:
 xattr -d com.apple.metadata:com_apple_backup_excludeItem <filename>
The CrashPlan article mentions this in particular to be able to back up VMWare virtual machines, which, oddly, have this attribute set.

After setting the attribute, you can run this command to make sure it's stuck:
sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
You'll find a list of files that Mac OS X excludes by default.
  Post a comment  •  Comments (5)  
  • Currently 4.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[4,475 views]  View Printable Version
Trim podcasts intros with AppleScript Apps
Many podcasts feature a lengthy intro that you have to hear every time you listen to a podcast. If you, like me, listen to fresh news podcasts every morning, you have to skip introductions manually just to get to the news section. Wouldn't it be nice if podcasts were trimmed automagically? Here's the AppleScript for that.

The script is based on Doug Adams' Reset Tracks Start script (GNU GPL). My version of his script goes through every track in a playlist and sets track start time to 90 seconds (you can adjust this number to suit your needs). "News" is the name of my playlist; change accordingly.

property my_title : "Trim all tracks in a playlist"
tell application "iTunes"
	set thePlaylist to playlist "News"
	with timeout of 300 seconds
		repeat with i from 1 to (index of last track of thePlaylist)
			my reset_this(track i of thePlaylist)
		end repeat
	end timeout
end tell

to reset_this(t)
	tell application "iTunes"
		try
			set start of t to 90.0
		on error m
			log m
		end try
	end tell
end reset_this

I use crontab to run this script every morning, but you can use iCal:

  1. Create a recurring event (every morning at 7 am, for example)
  2. Choose Alarm and select Run Script, locate the script file you've just created
Now, every morning at 7 am the script will quetly run and "trim" all the tracks in News playlist to make your mornings a little bit more efficient.

NB: "trimming" does NOT actually trim your tracks, it merely adjusts the starting point; this is totally reversible and instantaneous. If you want to undo this, just change 90.0 to 0.0 and re-run the script.

[kirkmc adds: This is sweet. The only problem is that different podcasts have different length intros. So what I'm going to do is make a number of scripts with different offset times and run them on selected podcasts, adding the podcasts as I want to a playlist on which the script acts. I asked Doug Adams how to change this script so it acts on a selection rather than a playlist. He said to use the following:
property my_title : "Trim all tracks in a playlist"
tell application "iTunes"
	set theSelection to selection
	with timeout of 300 seconds
		repeat with aTrack in theSelection
			my reset_this(aTrack)
		end repeat
	end timeout
end tell

to reset_this(t)
	tell application "iTunes"
		try
			set start of t to 90.0
		on error m
			log m
		end try
	end tell
end reset_this

You'll notice that only o couple if lines in the first part of the script are changed.]
  Post a comment  •  Comments (3)  
  • Currently 3.50 / 5
  You rated: 2 / 5 (8 votes cast)
 
[2,833 views]  View Printable Version
Benchmark your SSD or hard disk speed Apps
You can benchmark the speed of your SSD or hard disk using a few simple Terminal commands. To test write speed:
time dd if=/dev/zero bs=1024k of=tstfile count=1024
In the output, you should look for something that looks like "bytes transferred in 16.546732 secs (519131791 bytes/sec)." Copy and paste the bytes/sec speed into Google to convert to MB/s (e.g. Google search for "519131791 bytes/s in megabytes/s").

To test read speed:
 dd if=tstfile bs=1024k of=/dev/null count=1024
[kirkmc adds: While we're on the subject, here's an easy way to test data throughput from one disk to another. Open Activity Monitor (in /Applications/Utilities), click on the Disk Activity tab at the bottom of the window, then look at the Data read/sec and Data written/sec numbers. Copy a large file from one disk to another to see how fast it can go. FWIW, my new Thunderbolt drive has throughput of about 100 MB/sec.

You can run the above commands while watching the information in Activity Monitor, and skip making the conversions. This shows that I have a peak read speed of 137 MB/sec, and a peak write speed of 151 MB/sec (an SSD in a Mac mini). The commands above will give you average speeds, whereas Activity Monitor shows the speed in real time, as well as peak speeds. See the comments below for what may be a better approach.]
  Post a comment  •  Comments (17)  
  • Currently 4.00 / 5
  You rated: 3 / 5 (7 votes cast)
 
[48,625 views]  View Printable Version
Make your own Reduce File Size presets for PDF export Apps
I was never satisfied with results of "Reduce File Size" Quartz filter when trying to make some PDFs smaller before sending them by e-mail. It made them too small, and the graphics were fuzzy.

I eventually found where these filters are:

/System/Library/Filters

I was delighted to find out they're XML files easily editable with TextEdit (or any other text editor). I also found why this particular filter makes quite unusable PDFs, as these parameters were just too low:

Compression Quality 0.0
ImageSizeMax 512

So I copied this file to my Desktop, and then made two more copies of it, and called them Reduce File Size Good, Better and Best. Then I changed the parameters of each file to 0.25, 0.5 and 0.75 for Compression Quality, and used these three values for ImageSizeMax:

842 (that's A4 at 72dpi)
1684 (A4 at 144dpi)
3508 (A4 at 300dpi)

Finally, I changed the default string for the Name key at the end of each file to reflect the three settings, so they display the names I have given them in the menu.

Then I copied them to a /Library/Filters folder I created (for some reason, ~/Library/Filters doesn't work in Lion) and now when I open a picture or PDF in Preview, I have the option of four different qualities for reduced file sizes.

As an example, I have a JPEG of scanned A4 invoice at 300dpi and it's 1.6MB. When exporting to PDF in reduced size, the file is only 27 KB and it's quite unusable - very fuzzy and hard to read. The Good one is much easier to read, slightly fuzzy and still only 80 KB. Better is 420 KB and clear, and the Best is 600 KB and almost as good as the original even on a laser printer.

[kirkmc adds: Interesting hint. I see this as useful only for creating PDFs from files. If I'm scanning something, and I don't want the file to be too big, I'll either scan it at a lower resolution, or change the resolution in an image editor before making a PDF.]
  Post a comment  •  Comments (19)  
  • Currently 4.80 / 5
  You rated: 5 / 5 (15 votes cast)
 
[46,189 views]  View Printable Version
Share your iPhoto library with Aperture (or vice versa) Apps
I don't take a lot of photos, and don't use Aperture, but when I stumbled on this Apple tech note, I had a feeling that it might be useful to those who take a lot of pictures.

Apple explains how to use a "unified photo library with iPhoto and Aperture." Setting up the unified library isn't rocket science, but the document lists a number of limitations that are good to know about. If you use both programs, read this document to see how to share a library, and to see what you can and cannot do with each program.
  Post a comment  •  Comments (3)  
  • Currently 3.43 / 5
  You rated: 2 / 5 (7 votes cast)
 
[6,565 views]  View Printable Version
Discover entitlements for sandboxed applications Apps
In a conversation on Twitter yesterday, Daniel Jalkut, of Red Sweater Software, asked whether there was a way to find out what entitlements a sandboxed app has. Brian Webster, of Fat Cat Software, shared the solution. Apparently, this command provides the information:
codesign -dvvv --entitlements - /path/to/app
(Replace "/path/to/app" with the path to the application.)

Not being a developer, I don't know exactly what this all means, but to those readers who are developers, this may be useful.
  Post a comment  •  Comments (3)  
  • Currently 2.80 / 5
  You rated: 3 / 5 (5 votes cast)
 
[4,745 views]  View Printable Version