Advertisements

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

Advertisements

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:

home, downl, mov, musi, docu.

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.

🙂

will Mountain Lion work on my old mac?



If you’re wondering whether your machine can be upgraded to run OS X 10.8 Mountain Lion, you can check the full list of supported models below.

To find out which model of mac you’ve got, hold down the option key on your keyboard and select

 > About This Mac

Check the ‘Model Identifier’ against this list:

MacBookPro4,1
Macmini5,3
Macmini5,2
Macmini5,1
MacBookPro5,1
MacPro4,1
MacBookPro5,2
iMac8,1
MacBookPro5,4
MacBookAir4,2
iMac11,1
iMac11,2
iMac11,3
MacBookPro8,2
MacBookPro3,1
MacPro5,1
iMac9,1
Macmini3,1
MacBookPro6,1
iMac12,2
iMac12,1
MacBook5,1
MacBook5,2
iMac10,1
MacBookPro7,1
MacBookAir4,1
MacBookPro5,3
MacBookPro6,2
MacBookPro5,5
MacBookAir3,1
MacBookAir3,2
Macmini4,1
Xserve3,1
MacBookAir2,1
MacBookPro8,1
MacBook7,1
MacBookPro8,3
iMac7,1
MacBook6,1
MacPro3,1

Of course, just because your machine’s listed, it doesn’t mean it will necessary meet all the specifications, so be sure to check the tech specs too.

🙂

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

easy way to install Ubuntu on Mac OS X



If you have Parallels or VMFusion, you can download and run Ubuntu as a guest OS for free. Ubuntu has some nice features including a Spaces-like desktop switcher and loads of free software available in the Ubuntu App Store.




For those still on Snow Leopard but wishing they could have the benefits of iCloud, Ubuntu provides an interesting option: the open source OS comes with its own Cloud service and 5GB free space. You can sync it with Windows, Android and iOS, and it even allows you to stream music from the Cloud to your devices. If you run Ubuntu in Parallel’s ‘Coherence’ mode, you can take advantage of Ubuntu’s mail, calendar and music apps and have all your other devices synced to your Mac.

If you want to read more, go to the Ubuntu website. When you’re ready to give it a spin, it couldn’t be simpler:

1. Go to the Ubuntu download page, and choose either 32-bit or 64-bit depending on your current Mac OS (if you’re running SL 10.6.8 or later, go for the 64-bit). Ignore the advice about creating a CD or USB stick (it doesn’t apply to us as we’re going to install it via Parallels).

2. Click the big red/orange ‘Download’ box, and make a cup of tea while the .iso file downloads to your computer.





3. After the download has finished, start up Parallels. From the Parallels Desktop menubar, choose File > New.

4. From the resulting dialogue box, click the drop down menu and select Choose an image file…. Browse to your downloads folder and choose the .iso file you downloaded in step 1.

5. From here on in, Parallels will pretty much take care of everything else for you. Your virtual machine will restart a couple of times and you will get asked to choose a couple of options (like setting a language, region and password), but it’s all fairly self-explanatory. Accept the default options for now.

When the install finishes, the first thing to do before trying it out is to set the amount of RAM available to the Ubuntu install. You’d want to set this to at least 2GB, but 4GB is better to get a really fast machine.

6. To set the RAM, first shut down Ubuntu. Do so by going to the Parallels menubar and choosing Virtual Machine > Shutdown.

7. After the OS has shutdown, go back to the Parallels menubar and choose Virtual Machine > Configure. Click on General and set the slider to as much RAM as you can spare…






8. Finally, go play! Depending on your download speed, the whole procedure shouldn’t take much more than an hour or so. If you need documentation, just go back to the Ubuntu site and you’ll find plenty of resources there.

Enjoy. 🙂

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!

easiest way to find your serial number

Click  > About This Mac… then click on the greyed out text underneath the black ‘Mac OS X‘.

It probably says ‘Version 10.7.2’. When you click on it, it will change to the OS build number. Click on it again and you’ll see your serial number. Easy 🙂




why is my mac running so hot?

I’ve previously covered one issue here about overheating macs, but kernel_task is not the only process that can get out of hand. For example, there’s a known issue with some releases of Parallels that can cause a process called prl_disp_service to run up to 99% too, leaving your mac sweating on the desktop even on a cold Winter’s eve!

In general, ‘hot’ issues can be found by looking at what’s going on in your Activity monitor, and solved by quitting (or force quitting) the process. Also, don’t wait to discover these by how hot your mac feels to the touch. Download and install a free copy of smcFanControl and have it running in the menubar. Now you’ll have a reliable means of seeing exactly how hot your mac is. 🙂

However, some processes may not re-start correctly after being quit in Activity monitor unless you reboot the machine or work a bit of Terminal magic. In the case of Parallels, for example, if you’ve identified prl-disp_service as the culprit, the correct solution is to first stop your VM and quit Parallels. Then, open Terminal.app and follow this procedure:

1. Paste this command into Terminal

sudo launchctl stop com.parallels.desktop.launchdaemon

Press ‘Return’. You will be prompted for your password. Note that when you type it in, your typing will be invisible. Press ‘Return’ again.

2. Now paste this command:

sudo launchctl start com.parallels.desktop.launchdaemon

and press ‘Return’.

3. You need to check that the process has correctly restarted before trying to start up Parallels, so one last command:

sudo launchctl list | grep com.parallels.desktop.launchdaemon

The output should look something like this:

36468 – com.parallels.desktop.launchdaemon

The number on the left will be different, but so long as it is anything except 0, you are good to go!

4. Finally, in Terminal, hold down the ‘control‘ key and press the ‘c‘ key at the same time. Now you can quit Terminal and get back to a cool Mac and your Parallels VM. 🙂

You can use these same ‘stop’, ‘start’, and ‘grep’ commands for other errant processes, but you need to find the correct name of the process. You can do this by first noting its name in Activity monitor, then in Terminal, paste:

sudo launchctl list

Look for a launchdaemon that corresponds with the name you found in Activity monitor. Then use the commands above but replace ‘com.parallels.destkop.launchdaemon’ with the name of the process you want to kill.**

🙂

**Warning: The sudo command gives you root privileges to the computer and can cause irreparable harm to your OS if used incorrectly. Never mess around with the sudo command unless you have a recent bootable clone of your system.


Related posts:
Why is my mac running so slow?
kernel_task at 103%!!

%d bloggers like this: