Blog Archives

5 things you never knew about TextEdit

Text Edit Background Reflection




Although Apple’s oddball TextEdit.app has a variety of good formatting options, the chances are if you do any kind of word processing, you have one or more of the heavy duty apps like Pages, LibreOffice or Ms Word. If, on the other hand, you’re a coder or scripter who needs a plain text editor, you likely use Tincta, Sublime Editor 2, BBEdit, Coda or one of the many other full-featured editors that can do things like syntax colouring, snippet saving, script execution and so on that TextEdit can only dream of. Indeed, Apple have strangely forsaken giving their homegrown editor even a ‘line numbers’ option (though see tip 5 below), making it all but unusable for scripting.

Given its limitations, you might feel you haven’t been missing much by leaving TextEdit unloved and untouched in the Applications folder. However, here’s at least 5 reasons to think again.

1. Easiest way to create an audiobook.
I started off by calling TextEdit an ‘oddball’ app and here’s the first reason: name me another ostensibly “text editing” program that can make audio books? Dump any old text into a TextEdit window, and from the menu at the top choose ‘Edit > Speech > Start Speaking’. Plug in the headphones, sit back and relax! Works great with long online articles (but be sure to strip out any meta text and pictures first!). Also, don’t forget you can change the system voice in ‘System Preferences > Dictation & Speech’, and as I’ve pointed out elsewhere, foreign language learners can download optional voices and listen to foreign language text to improve their listening skills. For the parents among us, this one can also be great for the kids (both for them to listen to and create their own). 😉

To turn a TextEdit file into an audio book, select the entire text and from the menubar choose ‘TextEdit > Services > Add to iTunes as a Spoken Track’

add2itunes


2. Easy way to read, edit or save lengthy Terminal output
You can add

| open -f

to the end of any Terminal command, and (assuming TextEdit is your default editor) the output will be piped to a TextEdit window. This makes it easy to search, save or just scroll the output. This is particularly useful for reading and saving man pages. However, be aware that for some bizarre reason, man pages in particular tend to duplicate a number of characters in certain fields, which can affect readability. To prevent this here or with any other output you encounter that does the same, use

| col -b | open -f

after the Terminal command.

For example, if you enjoy hunting down defaults tricks, try this in Terminal. Type

defaults read | col -b | open -f

3. Easy way to get a file path
You can drag and drop any item from a Finder window into a TextEdit window to reveal that item’s path. This is a very handy trick if you need to quickly copy a file path to the clipboard. You can also drag urls from Safari’s address bar into a TextEdit window, or just drop them onto its Dock icon to get the same effect.

4. Easily share TextEdit content or files
Although TextEdit lacks the ‘Share’ icon in the menubar that was introduced to many apps in Mountain Lion, you can still access the ‘Share’ feature through the contextual (‘right/control click’) menu. Another oddity of TextEdit lurks here though: make sure the cursor in the TextEdit window is not on an empty line, or you won’t see the ‘Share’ option in the menu.

share

5. (not so) Easy way to get line numbers!
This one is for the coders among you. We all know TextEdit suffers from the lack of a ‘View line numbers’ option (come on, Apple – ridiculous!). There’s a few tips here. First, if you don’t know already, you can use the hotkey ‘command-L’ to go to any given line number. You can also find the total number of lines by using the ‘Find’ feature. Hit ‘control-F’ first, then click the spotlight in the filter bar. Choose ‘Insert Pattern’ and search for line breaks. You’ll see the total number of line breaks in the far right of the filter bar:

linebreaks

You can add pseudo (see below for why I call them ‘pseudo’) line numbers with a bit of Awk magic. Open Terminal.app and paste this into the window:


awk '{print FNR "\t" $0}'

Next drag and drop the file you want to add line numbers to into the Terminal window. Don’t worry, nothing you do here will change the original file. Apply your new found skill from Tip 2 above, typing a space and then a pipe onto the end of the command:

| open -f

so the whole thing might look something like this

awk '{print FNR "\t" $0}' ~/Desktop/myfile.txt | open -f

and hit ‘return’. Hey presto, you have a TextEdit file with “line numbers”.

Screen Shot 2013-03-25 at 21.23.13

Now, here’s the catch. I called these ‘pseudo’ line numbers because unlike real line numbers, the numbers are actually part of the text. That means if you select some portion of the text that spans line numbers, the numbers will be selected and copied too. In other words, you can’t properly copy and paste text, so be sure to keep your original version of the file for future editing purposes (*EDIT: see a workaround for this provided by Caroline in the Comments below).

So yes, TextEdit is an oddball program; it is like no other I know of for containing a bizarre mix of unrelated yet strangely powerful features coupled with the inexplicable absence of basic functionality that any other program would be handicapped without. Nonetheless, I hope this post has given you some ideas of how you can use TextEdit to better effect in your work and play. 🙂

Featured picture: Purple Glass Text Edit Icon by ~Drawder

how to recover disappearing Notes

disappearingNotes@applehelpwriter.com



There appears to be a bug in Apple’s Notes.app in OS X 10.8 that sometimes causes notes to disappear. If you need to recover the text of any note that’s gone missing on your mac, try pasting this into Terminal.app. It’s all one line, so copy and paste it as a whole, then hit ‘return’:


cd ~/Library/Containers/com.apple.Notes/Data/Library/Notes; strings NotesV1.storedata | grep body | open -f

The resulting TextEdit window can be searched or scrolled through for your missing text.

Due to this problem, a lot of people are giving up using Notes.app altogether and switching to alternatives like Evernote or nvALT. However, if for some reason you either want or need to keep using Notes, you might try saving that command above as its own little App that you can keep in the Dock (beats having to dig out or remember the Terminal code all the time).

To do so, we’re going to use the Applescript Editor. It lives in the /Applications/Utilities folder, but you can access it simply by clicking on Spotlight and typing Apples.

With the Editor open, paste this into the window (note, this is slightly different from the command above, as we have to tell AppleScript how to use the code):


do shell script "cd ~/Library/Containers/com.apple.Notes/Data/Library/Notes; strings NotesV1.storedata | grep body | open -f"

Press ‘Command-K’ to compile the script. If there are no errors, hit ‘Command-R’ to run it. If everything checks out fine, then hit ‘Command-S’ to bring up the ‘Save’ box. Change the ‘File Format:’ option at the bottom to ‘Application’, give the app a snappy name (‘findNotes’ ??), then choose your Applications folder as the destination before hitting ‘Save’.

Save Dialog in Applescript Editor

The last thing to do is to go to your Applications folder and drag the icon to the Dock. Now, you can simply click the icon to produce the TextEdit window whenever a Note goes missing.

(Final tip: by the way, if you don’t like the Applescript icon in your Dock, you can always change it to an icon of your own! 🙂 ) )



Related posts:
getting to grips with AppleScript
sync notes between mac and android
FastTasks – download the free OS X utility from Applehelpwriter

5 things you never knew about Spotlight

spotlight_icon



Whenever I’m helping customers with a misbehaving Mac, one of the most common things I hear is ‘Wow, I didn’t know you could do that with Spotlight!’ Whereas the average user will navigate around their computer by trawling through Finder, the savvy user knows how to get to places, launch apps, search the internet and calculate their tax with a few simple Spotlight tricks. In this post we’ll look at how to increase your productivity by using Spotlight for fast access to a variety of common functions. But first, we need to get Spotlight set up for maximum efficiency.

Set up the hotkey
To get the most out of Spotlight, the first thing to do is set up the keyboard hotkey. By default, this is usually ‘command-spacebar’, but if you are using multiple languages you might want to reserve that for the Input Switcher. Instead, I use ‘option-command-spacebar’, not least because this nice 3-finger combination can be executed with the left-hand while the right hand is reaching for the coffee mug… 😉

Whatever your choice of hotkey, keep it close to the bottom of the keyboard, as the other keys that you will want to be able to rapidly access are the cursor arrows and the ‘return’ key. If you haven’t set up your Spotlight hotkey yet, the fastest way to do so is to click on Spotlight on the top right of your screen with the mouse or trackpad and type 

spot 

and then hit ‘return’ on the keyboard (if Spotlight isn’t the top hit, just use the arrow down key to move down till you hit it)

Spotlight




After hitting ‘return’, you’ll be presented with the Spotlight preferences panel. At the bottom, you’ll see fields to define both the Spotlight menu keyboard shortcut and the Spotlight window keyboard shortcut. For the purposes of this post, we’re only interested in the menu shortcut (but feel free to set up the window one too, if you wish!). Once your hotkey is set up you can forget about the annoying inconvenience of dragging your cursor up to the top right corner. Just hit your hotkey combination to open the Spotlight search field.

System Prefs for Spotlight



But don’t close the Spotlight prefs just yet. The main pane in the window is the Search Results panel which lists the order in which results appear. You can alter the order of results that Spotlight shows by dragging items up and down the list. Altering this to your likes is a big part of getting the most out of Spotlight. If Spotlight is always showing you lots of results from Mail that you don’t want to see, for example, drag “Messages & Chats” to the bottom of the list.

For the purposes of this tip, make sure Applications is no.1 in the list and System Prefs no. 2, and Folders at no. 3. Follow that with Documents, Images, PDFs and so on according to the kind of files you access most often on a daily basis. A set up like this will make Spotlight much more efficient at navigating around your mac, and once you get the hang of it you’ll find yourself trawling through Finder much less often.

Incidentally, I don’t recommend unchecking any of those boxes. We want more power in our searches, not less; you never know when you might be looking for something that just won’t show up in a search because you’ve forgotten that you excluded those results in Spotlight’s preferences. Besides, there are better ways to restrict your searches in Spotlight like this and this.

When you’re done with setting up Spotlight’s preferences, hit ‘command’ and ‘Q’ to close System Preferences and read on.


1. Use Spotlight as an App Launcher
Long before the Apple engineers dreamed up Launchpad, many of us were already launching apps in half the time it takes in the Dock, Finder, or (now) even Launchpad itself. You can open any app with Spotlight just by typing three or four characters. Sometimes, just one is enough! All you need to do is hit your hotkey (see above) and type the first three or four letters of the App’s name and hit ‘return’.

Try typing tex and hitting ‘return’ to instantly open TextEdit, or act for ‘Activity Monitor’. iPhoto should be the top hit with ip. If you use Terminal a lot, there’s no need to go rooting around in the Applications/Utilities menu to open it. Simply hit the Spotlight hotkey and type

term

and hit ‘return’.

If you have Carbon Copy Cloner, type CCC, and if you use 1Password, just the number 1 and return should do the trick.

saf will open Safari and mai will launch Mail in an instant. Experiment with your favourite or most commonly used apps and you’ll find that using Spotlight is twice as fast as any other method.

As a bonus, if you moved Folders up to no.3 in the Preferences list, experiment with the first few letters of your favourite folders. Try some of these and see what comes up as the top hit:

homedownlmovmusidocu.

2. Use Spotlight to access System Prefs
We already saw one of Spotlight’s hidden uses – fast access to System Preferences. In fact you can do this with any of them. Want to check your login items in Users & Accounts | Login Items? No need to go clicking all round the desktop, hit your Spotlight hotkey and type

user

or

secu

if you want to change your Security preferences quickly.

Don’t hit ‘return’ just yet – check to see what is the ‘top hit’, as you might find that you have to “arrow down” an item or two. Even so, this is a whole lot faster than wading through either Finder or the  menu.

Typing

sys

and hitting ‘return’ is also a fast way to open the main System Preferences panel.

3. Dictionary
Hit the Spotlight hotkey and try typing the word 

codec

Just press ‘command-L’ to go straight to the dictionary entry and see its definition in a pop-up panel. Alternatively, hit ‘command-D’ to open the word in the Dictionary app.

Also note that in Spotlight, you can jump around by holding down the ‘command’ key and pressing the down arrow key (each press of the arrow key conveniently takes you to the top of each section; release the ‘command’ key and use the down arrow alone to move one item at a time within the section). Using the ‘control’ key and the down or up arrow takes you to the very bottom or the very top of the list, respectively.

When you’re done with Spotlight, just hit your hotkey combination again to dismiss it. You can also use the ‘esc’ key here: one tap of ‘esc’ will clear the Spotlight search bar, two will dismiss it.

4. Website search
But suppose you type in a word that Dictionary.app doesn’t know? Try

plomic

Again, use your command and arrow key to jump down to the bottom of the results and this time choose ‘search the web’. That will automatically open Safari and put the term in the search bar and return the results. But you’re not limited to dictionary searches, you can use Spotlight’s search bar just like the Google search bar in Safari. Try typing in

mini ipad versus samsung galaxy review

or

best small car of 2012

or anything else you might want to search the web for. Yep, Spotlight isn’t just a file finder on your mac – it’s a google search engine, too!

5. Use Spotlight as a Calculator
Want to quickly know what 17.5% of $45,000 is? Hit your Spotlight hotkey and type:

45000*17.5%

Don’t press ‘return’ – difficult to break that habit, I know! – the result is already listed next to the ‘Calculator’ icon, just look down to see the search results and the answer is already there!

You can of course do all the standard calculator functions like / for divide, * for multiplication and + and – for addition and subtraction. You can even do powers (3 to the power of 5 = 3^5) as well as bracket expansion. Try

(3x5)^2 and compare the result with 3*5^2

So whether its App launching, web searching, opening system prefs or using the dictionary or calculator, hitting your Spotlight hotkey is a habit you want to develop for faster computing. At least for me, it’s probably the most frequent keystroke I use on a daily basis.

🙂

Camtasia 2 reviewed

I’ve been a long time user of TechSmith’s Camtasia screen capture software, primarily for two reasons: ease of use combined with a rich set of editing features. Camtasia for Mac 2 strengthens this product in a number of significant ways although there are still some usability issues that need addressing, as well as room for further improvements in the feature set. In this review, I’ll walk you through what Camtasia has to offer as well as indicate the kind of uses where it excels as an aid to the technical communicator. Read the review…

how to get Spaces and Expose on Lion

(Note: If you’ve just installed Mountain Lion, be sure to run ‘Check for Updates’ by clicking on the Total Spaces icon in the menubar)

Yes, it’s possible to bring back most of those beloved Snow Leopard features that Apple unwisely did away with in Lion, and – if you get them now – for free with 3rd-party apps. I’ve been hunting down a way to get rid of all the Mission Control behaviour on my trackpad, to return the app-switcher trackpad gesture, the 2-dimensional Spaces grid and, of course, Expose.

OK, so here’s how I finally got all those lovely Snow features back to Lion. You’re going to need two free tools (free for now, so don’t hang around…), namely:

Total Spaces from http://totalspaces.binaryage.com
Better Touch Tool from http://blog.boastr.net

Once you’ve downloaded these you’re half way there, but you’ve got to complete the job by setting them up properly. In the remainder of this post, I’ll walk you through how I’ve got them set up. Try it this way first, then once you’ve got the hang of it, you can tweak it to your own style. 🙂

1. Total Spaces > Preferences:

</p?

In BetterTouchTool Preferences:





In  > System Preferences > Trackpad:

Finally, disable the Mission Control hotkeys in  > System Preferences > Keyboard | Keyboard Shortcuts:

With this configuration, you change spaces by holding down ‘option’ and any of the arrow keys to move round a grid of 9 spaces (you can have more or less if you want in TotalSpaces prefs).

You see all spaces (like the screenshot at the top of the page) by holding down ‘command-option-left_arrow’.

You bring up Expose with a 4-finger downward swipe on the trackpad (note: Expose is unavailable while an app is in Full Screen mode), and the App Switcher with a 3-finger tap.

Oh, and Mission Control? Drag it off the Dock to about centre screen and release. Should you ever need it you can always go and double-click on it in your Applications folder, but otherwise you’ll soon forget it ever existed.

And that’s it — proper Spaces, Expose, and Trackpad functionality restored! 🙂

QuickTime won’t play my video



With the announcement that the developers of Perian are to discontinue their QuickTime plug in, it’s probably time you switched to using the open-source video player VLC.

Not only does VLC play video files that QuickTime can’t play even with Perian, it will also attempt (and often succeed) to play files that suffer from minor corruptions.

If you’re having problems playing a video file in QuickTime, chances are VLC is the answer.

🙂

Direct Download: http://sourceforge.net/projects/vlc/files/2.0.1/macosx/vlc-2.0.1.dmg/download
Project Site: http://www.videolan.org/vlc/index.html

‘delete’ doesn’t send files to Trash

Image

If you find deleting a file deletes it immediately without sending it to the Trash first, you may need to fix permisssions on your Trash folder.

Open Terminal (Applications > Utilities > Terminal.app) and type

ls -alF

Scroll up if necessary to the beginning of the list and you should see a couple of folders whose names begin with a dot.

.Trash
.Trashes

Ignore .Trashes, but look at the permissions on .Trash, they should read like this (also see the pic above):

drwx- – – – – – <your_username> staff (size) (date) .Trash/

Ignore the numbers, but if the permissions are different or the username is not your account username, then do the following:

At the Terminal command prompt, type the following, replacing ‘your_username’ with (yep, you guessed it…) your username.

sudo chown -R your_username .Trash

For example, if my user name is ‘SnowLpd’ I would type
sudo chown -R SnowLpd .Trash

Then press ‘Return’. You will need to enter your password, which will be invisible when you type it (so type carefully). Now go and test your ‘delete’ function to see if the problem is cured. 🙂 

Related Posts

why does Trash ask for a password? (Permissions Part 1)

how to remove a boot.efi file from Trash

Click on the Trash can on the Dock, hold down the ‘option’ key and click the ‘Empty’ button over there on the left side of the window. If this doesn’t do it, the file may be in the .Trash folder of your Time Machine (TM) or some other disk.

To find out if that’s so, follow this procedure:
 
1. Open Terminal.app, copy and paste the following command into the Terminal window
 
defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder
 
Then press ‘Return’.
 
2. Open a Finder window. Navigate to the TM disk starting from its icon in  the left hand column. You should see some greyed out folders called .Trash and .Trashes. Click on these and have a look for the boot.efi file that we’re hunting down.
  
To remove the boot.efi file from the hidden trash, try the following:
 
3. Go back to Terminal and copy and paste the following:
 
sudo rm -rf
 
Do NOT press ‘Return’. Instead, press the Spacebar once, then use your cursor to drag the boot.efi file from the hidden folder in Step 2 and drop it in the Terminal window. Now press ‘Return’. You will be asked for an administrator password and given a warning which you can ignore. Type in your password, but notice that your typing will be invisible, so type carefully.

Press ‘Return’.
 
4. If you typed your password incorrectly, repeat step 3. If you typed it correctly, hopefully, your Trash is empty. 🙂
 
5. The last thing is to hide all the hidden files again, so copy and paste this:
 
defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder
 
Then press ‘Return’.
 
You can close Terminal now.
 
 
Good luck!

how to remove Lion Recovery disk



If you have reverted your mac to Snow Leopard from Lion, its important that you also remove the Recovery HD, as it can compromise the security of your Snow Leopard installation (for security issues with Lion, see here). Reverting to SL via Time Machine or restoring from a clone will leave the Recovery partition in place, meaning anyone can boot into it and reset your Snow Leopard passwords merely by restarting your mac while holding down the ‘option’ key.

To remove the Recovery disk follow this procedure:

1. Revert back to Snow Leopard using Time Machine or a clone.

2. Once you’re up and running and have confirmed everything is good, go to Terminal (Applications > Utilities > Terminal) and paste/type this command to confirm the presence of the Recovery HD:

diskutil list

then press ‘Return’. If you see a partition labelled something like this

Apple_Boot Recovery HD (see image above)

then you will need to continue with the rest of the procedure. If the Recovery HD is not listed here, you do not have the Recovery partition and need not worry further.

3. If you find the Recovery HD in the list, paste the following command into Terminal:

defaults write com.apple.DiskUtility DUDebugMenuEnabled 1

Press ‘Return’.

Now open Disk Utility (Applications > Utilities > Disk Utility). In the menubar at the top, choose Debug > ‘Show every partition’

On the left in the main Disk Utility window, you’ll be able to see ‘Recovery HD’ (it’ll be greyed out). You can click ‘Mount’ in the taskbar to make it active, and you can now delete it using control-click/right click – erase or by using the ‘erase’ tab in DU’s window.

If you want to confirm that the Recovery disk is no longer present, go back to Terminal and type the command from step 2.


Related posts:
how to secure your mac (OS X Lion)