Clean up Google Mail Folder Structure on your iPhone
If you use GMail, or Google Apps for Your Domain on your iPhone, you've probably noticed an odd folder structure, with most of your folders being found under [Gmail]. This looks ugly, and it turns out, is easy to fix:
- In your "Advanced" Mail account settings, set the IMAP Path Prefix to "[Gmail]/"
- (The trailing / is added automatically)
Now your folders will look flatter and much prettier. This works in Mail.app on your desktop Mac too! And don't worry -- it'll still be able to find the Inbox on its own.
Using Mail.app with multiple users — using AppleScript: Part 2
The previous post, about hacking multi-user support into Mail.app, seems to have struck a chord, and there have been lots of great questions about how to extend the script, or customize its behavior or appearance. Things tend to get lost in the comments, so I figured I'd create a part 2 to answer some of the questions that have popped up. If you haven't already, check out part 1 to get caught up.
Some of these might seem a little basic to long-time users, but lets remember that not everyone has been using a Mac since OS 7 (or earlier!) and cut the newly Mac-faithful some slack...
Evan asks: Absolutely perfect, exactly what I was looking for. Well, almost. How about adding a 3rd account?
The first thing you'll want to do is update our crude little user interface to ask about the third account. This line here decides what options show up in the dialog box:
display dialog "Choose the Mail account to use" buttons {"Jonathan", "Nicole"} default button 1 with icon note
You can add as many up to 3 options as you want, just by comma seperating them, so instead of {"Jonathan", "Elizabeth"} you could have {"Jonathan", "Elizabeth", "David"}
Then you need to modify the "if" statement to support each individual referred to. In the original we said:
if the button returned of the result is "Jonathan" then
-- do stuff to change account to Jonathan
else
-- do stuff to change account to Elizabeth
end if
The else is a problem now because it assumes only two conditions. Instead of an else, we can do an else if -- one for each individual we want to switch between:
if the button returned of the result is "Jonathan" then
-- do stuff to change account to Jonathan
else if the button returned of the result is "Elizabeth" then
-- do stuff to change account to Elizabeth
else if the button returned of the result is "David" then
-- do stuff to change account to David
end if
Inside each condition you'll need to disable all the other accounts (set enabled to account X to false) and then enable the account they've chosen.
Eric asks: I would like to attach to the script the mail icon or a similar icon. Then when I added it to the dock, it is more obvious to click it to run.
Note: This will be limited by permissions, so if your user doesn't have permission to 'write' to the target object, you won't be able to paste.
Eric, having figured out the above on his own, then asks: My 2 problems are: 1, I can not add the script to the dock. 2, when I click the script icon, it take me to the editor where I then have to click RUN.
Under most circumstances you won't want to check the box for 'Run Only' because once you do, you cannot edit it in Script Editor again. Also, uncheck the box for 'Startup Screen' to make it run a little more gracefully.
You may also find that the Dock is not the best place for your script -- since it will essentially give you two Mail icons. What I did instead was to enable the AppleScript menu and use that for all my common scripts.
If you want to do this, open the Application AppleScript Utility in the AppleScript folder and check the box for 'Show Script Menu in the menu bar.' You may also want to uncheck the box for "Show Library scripts" to hide the example scripts Apple includes to make your menu shorter.
Note: For scripts to show up in this menu you'll have to save them where your Mac expects your scripts to be: In your user's Library folder you'll find a folder called "Scripts." Put them, or an alias to them, in there.
Tunneling For Security – Problems with a Proxy
Here's the problem I'm currently working on. I don't have it solved yet, but I'm close -- blocked from educating myself further by the very system I'm trying to escape. At any rate, here's what I've got so far...
For purposes of security, I want to tunnel my traffic through SSH... on a Mac... behind a Proxy.
You'll find lots of webpages when you search for "ssh through proxy" that tell you how to use SSH as a proxy server. But I already know how to do that. I want to put that to use, but behind an existing proxy which limits Internet access. This isn't nearly as well documented.
For starters, on Windows you can use Putty, or the excellent app Tunnelier to establish an SSH tunnel to your home server, even behind a Proxy. You simply need to provide the proxy settings.
This is very useful because if you're in a coffee shop, or somewhere else with open and exposed WiFi, it might be important to you that your passwords or online banking are encrypted.
On the Mac, there's a decent app called SSH Tunnel Manager that provides a UI for connecting to a tunnel. Its not much easier to use than a command line, but it does make things simpler. The only problem is, its not proxy aware either. It only works on an already unfettered Internet connection.
So we're back to the command line, trying to teach SSH how to use a Proxy server for its 'Net connection. What I've learned:
- SSH does not natively know about Proxy servers, but it does provide extensibility so that you can configure it to get help from another program
- You configure this by editing the /etc/ssh_config file using a text editor
- man ssh_config reveals that the parameter you want to add is called: ProxyCommand
- A *nix app called Corkscrew provides this functionality for other flavours
- The app has been ported to Mac via the Darwin Ports project
- You can download DarwinPorts and make it work like apt_get by syncing it with its server
- Then you can tell it to install Corkscrew for you
- The DarwinPorts app uses rsync to get the latest sources to install on your computer
- rsync does not natively know about Proxy servers, so the sync will fail and you won't be able to get Corkscrew...
I'll try to get Corkscrew installed when I'm not stuck behind a Proxy and see if I can't figure out how to edit the ssh_config file to make it use a proxy server. What's frustrating is that the Mac has the Network System Preference that claims to be global, but that none of the command line apps they provided in their BSD flavour respect that configuration...
I'll post more if I figure this out.
XBox360 + Connect360 + Linksys WRT54g (firmware hacked)
Nullriver's Connect360 is a fantastic little app that you can run on your Mac that will fool your XBox 360 into thinking its talking to a PC, allowing you to share your iTunes, iPhoto and video libraries with the 360 dashboard. The video transcoding is a little lossy, but for SD applications it works exactly as advertised. Well worth the $20 they're asking.
According to the Connect360 Support website, you can't use Connect360 on your Mac to connect to your XBox 360 if your network uses a Linksys WRT54g with homebrew firmware on it. They're right -- it doesn't work.
The solution is pretty simple, however. Abstract the Mac and the XBox from the router using a good* network switch. The switch will allow the two devices to communicate (via broadcast) with each other without having to go through the router, and all will work as expected.
*Note: The Connect360 site also warns that some switches may cause a similar problem. I'm using a NetGear Gigabit Switch to accomplish this, and it works perfectly. YMMV.
Using Mail.app with multiple users — using AppleScript!
OK, this is pretty brilliant -- and SO simple.
Here's the setup: my wife and I share a Mac at home. For memory reasons, among others, I don't want to use Fast User Switching, and because of my automated tasks, I don't want the primary account to ever be logged out. So all many of our programs need to be set-up for two different users. Firefox has user profiles, that once configured, works perfect. Mail.app has no such thing. What I decided to then, was write an AppleScript that would switch Mail.app between users for us. This example is for two users, but it could be edited for more. Here's how to use it:
- Setup Mail accounts for each user
- Modify the script to prompt for each user you have, and reference their account name
- Replace your Mail.app dock icon with a link to your AppleScript (you can even give it the Mail.app icon)
- Whenever you launch Mail, you'll be asked which user you want to use
- Even better than that, you can switch users just by clicking the Mail icon in your dock again. You don't even have to close down Mail!
The result looks like this whenever you invoke the script, and launches/reconfigures Mail within two seconds. Set the delay to longer if Mail.app takes longer to start on your Mac.

The code is dead simple, and took me only moments to put together. Note that the delays and the order in which things are done is important so that it doesn't hang waiting for Mail to start if its not already open.
-- Mail Account Chooser, by Jonathan Wise
-- Add user profiles to Mail.app
display dialog "Choose the Mail account to use" buttons {"Jonathan", "Elizabeth"} default button 1 with icon note
if the button returned of the result is "Jonathan" then
tell application "Mail"
activate
delay 2
set enabled of account "Elizabeth Home" to false
set enabled of account "Jonathan Home" to true
end tell
else
tell application "Mail"
activate
delay 2
set enabled of account "Jonathan Home" to false
set enabled of account "Elizabeth Home" to true
end tell
end if
Using the Mouse Wheel in VB6
I'm embarrassed to say that I'm using VB6 at work right now. I haven't used VB since college, and it feels pretty old school. One minor annoyance, besides the sheer age of the language/environment is that you can't use the mouse wheel to scroll through your pages and pages of hard-to-read code. Fortunately, there's a fix: