Posts Tagged Mac

Working with PDFs in OS X

I've just been playing around creating some eps files with gnuplot, and have subsequently had to convert them to PDFs for someone else to view. Turns out I wasn't aware of the following:

1) You can drag-and-drop pages within PDFs in Preview.app, to re-arrange the page order. You can also delete pages using the Edit menu (and add blank ones, if that floats your boat). More detail here.

Editing a PDF in Preview.app

Editing a PDF in Preview.app

I've also just discovered that you can use Cmd-R to rotate either a single page or all pages between portrait and landscape orientation.

2) If you're a fan of the command-line, there's a built-in script to join multiple PDFs. I originally found it on this blog (turns out they're investigating protein misfolding and aggregation, small world). Basically, you can find the script at the following location (all one line, obviously):

/System/Library/Automator/Combine PDF pages.action/Contents/Resources/join.py

If you want to add the path to your .profile file, don't forget to put it in quotes otherwise OS X will baulk at the spaces. To use the script, just go like so…

~ $ join.py -o output.pdf input1.pdf input2.pdf ... inputN.pdf

I'm not suggesting these are particularly life-changing pieces of news, but I wasn't aware of them so thought I'd spread the love.

Tags: , , ,

Toggle Bluetooth with Applescript

I've just written a little Applescript to toggle the Bluetooth power on my MacBook on or off. It doesn't take any parameters or anything, it literally just toggles it off if it's already on, or on if it's already off. The script looks like this:

#! /usr/bin/osascript
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# *  Author:	Haydn Williams
# *  URL:	http://www.haydnwilliams.com
# *  Date:	March 2008
# *  Script:	toggleBluetooth.scpt
# *  Purpose:	Toggle bluetooth status
# *  Useage:	toggleBluetooth.scpt
#  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
tell application "System Preferences"
	activate
	set current pane to pane "com.apple.preferences.Bluetooth"
	try
		tell application "System Events"
			tell process "System Preferences"
				click checkbox "On" of window "Bluetooth"
			end tell
		end tell
	on error
		display dialog "Failed to toggle bluetooth."
	end try
	tell application "System Preferences" to close the first window
end tell


You can download the compiled script from here. Please note that you'll need to 'Enable GUI Scripting' in the AppleScript Utility (you can find it in the AppleScript folder of Applications). To run the script, just double-click on it. Please note that this will probably only work on English language systems, but should be easy enough to alter.

Tags: , , , ,

PS CS3 on a Case-sensitive Mac

Over the last two and a half hours I've patiently sat installing Mac OSX 10.5 Leopard (it's very nice, but more about that later). During the installation I was asked whether I wanted to format my drive as case-sensitive or case-insensitive. Because I play around with code a fair bit, I plumped for the former. Everything worked fine until I tried to install Photoshop CS3 Extended Edition, at which point I was greeted with the following message:Photoshop CS3 installer refusing to play ball with a case-sensitive file systemThat's right, Photoshop CS3 will not install on case-sensitive systems. A quick Google reveals that quite a few people have run into this problem. There are ways around it, but they're a bit convoluted, and the various authors do all seem to admit that they haven't tried every feature. One solution even involves dealing with a message prompt every time you open CS3. To be fair, Adobe have acknowledged the issue, but they've also said that "lacking a case for the user benefit provided by case sensitivity" they don't intend to do anything about it any time soon. So it looks like I'm re-installing Leopard this evening; today's lesson is that if you're going to run Photoshop CS3 on a Mac, please please please don't choose a case-sensitive format for your hard drive.

Tags: , , , , , ,