useful applescript

I’ve been hooking up my MacBook to the setup (mouse/keyboard/lcd) usually connected to a Windows machine over the last few days.  It works great except for the reversed Command + Option on the keyboard mappings.  I googled for something eloquent and found this;  Unfortunately whenever he did that it is outdated now.  I updated it for Leopard, and I can now just use Spotlight to execute "Change Keyboard" as I saved it as an Application to my Applications folder with that name.  Here is the updated version;


tell application "System Preferences"
    set current pane to pane ""
end tell

tell application "System Events"
    get properties
    tell application process "System Preferences"
        click button "Modifier Keys…" of tab group 1 of window "Keyboard & Mouse"
        set commandKey to value of pop up button 1 of sheet 1 of window "Keyboard & Mouse"
        — DEBUG
        — display dialog commandKey
        —  Default, lets flip
        if commandKey ends with "Command" then
            — click the pop up button menu "Option", this menu does not exist until it is clicked in the GUI
            click pop up button 2 of sheet 1 of window "Keyboard & Mouse"
            — click "Command" of the pop up menu
            click menu item 4 of menu 1 of pop up button 2 of sheet 1 of window "Keyboard & Mouse"
            — delay briefly
            delay 1
            — click the pop up button menu "Command", this menu does not exist until it is clicked in the GUI
            click pop up button 1 of sheet 1 of window "Keyboard & Mouse"
            — click "Option" of the pop up menu
            click menu item 3 of menu 1 of pop up button 1 of sheet 1 of window "Keyboard & Mouse"
            — delay again
            delay 1
            — Not Default, lets flip it back
            click button "Restore Defaults" of sheet 1 of window "Keyboard & Mouse"
        end if
        — click "OK" to dismiss the sheet
        click button "OK" of sheet 1 of window "Keyboard & Mouse"
    end tell
end tell

tell application "System Preferences" to quit

more video for fun and profit

Well, I read more, and I played more.

First, the original video I posted sucked.  I couldn’t figure out why iMovie HD was degrading the video for the life of me.  I tried every encoding setup known to man, but just couldn’t figure it out.  Finally I realized that when I had originally hit "Create a New Project", I had selected to save it in MPEG, instead of DV.  This meant I was starting with already compressed video from the beginning!  I realized it when I had finally posted the first project all over the web and started to work on another video.

So.. I started over the first one with DV, re-did all the editing, re-exported, and it was the same as the original AVI quality.  Woohoo!  Next I spent a few hours scouring the web for what h.264 bitrates should be used to represent standard definition (480p) and high definition (1080p) video.  I’ve come to the conclusion that there is no clear direction amongst the world.  However, I have to make some decision, so my belief based on reading is that 2mbps for 480p and 8mbps for 1080p are appropriate with h.264.  Since those reference average bit rates, I will set the QT encoding to a max bit rate of 2.5mbps for 480p and 10mbps for 1080p.

My logic for the audio is pretty similar since I do all my MP3s in 192kbit VBR, and the AAC is set to 224kbit.  If I ever end up with video taken with a better audio feed than a basic handheld camcorder/camera, I’ll have to return and play with that part more.

macbook update

I said a while back there was a rumored software fix for my mouse woes on the MacBook.  They did indeed come out shortly after that and resolved my problems.  It’s a bit odd to use the mixture touch/click on a single surface still but I’m getting more used it every day.


I upgraded gallery to the newest release yesterday.  It adds a pretty sweet new flash slideshow I think everyone will like for the photos.  Let me know what you think.

I also upgraded the blog today, so let me know if either one causes anyone problems.

free market my ass (Fed steps in to rescue ailing insurer AIG) (SEC imposes emergency ban on short-selling) (Believe it when you see it.)

So we know Carter and then Reagan removed much of the economic regulation of corporations.  I mention both so I don’t have to hear idiotic party finger pointing.  In theory this was to move more towards a true and pure capitalist market, and expand the economy.  Most would say that worked well.  It may have stifled small business and competition, or hurt workers’ rights, but the federal government would argue that our GDP expanded and the nations’ economy benefited.  Some would argue workers’ rights and small business protection are state or city issues, others would argue that’s a load of crap, but the end result is our country’s economy got better and the federal government could claim success.

So.. now we have companies taking bad business risk, and nothing is stopping them.  What would those that think deregulation is still the right way say?  They would say, as a true capitalist would, you invest in those companies so you should watch them.  The reality is I invest in index funds, mutual funds, bond funds, and trust those fund managers to watch them.  I don’t have the time to watch each individual company or entire market segments.  I can barely stay on top of the fact that Nortel is crumbling underneath itself in my own market.  These fund managers are pressured to show results, and they sure aren’t going to call out wildly successful markets or individual companies in most cases.  So what’s left?

Well, when people get scared, they look to the government.  They want the government to step in.  Is that the answer though?  It seems like the fundamental problem here was companies taking risk, the economy being too invested with that risk, and us seeing the bear to counter our boom.   How do you fix that?  To me, it seems like the SEC responsibility here should simply be to find a way to be sure more people understand the risk better.  Maybe the government should be rating debt of public companies based on a standard method of risk assessment so investors and the public can understand their risk better?  Maybe the investment houses’ risks should be rated on funds more consistently and accurately?  I’m not sure what the answer is, but making sure everyone understands risk to a better degree seems like the fundamentally right direction from my economically ignorant perspective.

I don’t think actually stopping these companies from doing things is the right answer.  After all, the ability to excel in a risky environment is what makes companies rise.  Removing the ability to be risky will surely stifle our international ability to excel in the long run.  Our real issue was too many companies taking too much risk.  How would the government oversight decide who gets to risk what and how much?  That seems like a bad way to regulate to me.  However, if we had more information about our collective risk, would we have had the market so heavily invested in this way?  Obviously the housing boom wouldn’t have been as much of a boom if less of these risky mortgages had been allowed, but would that be such a bad thing?

Let me know what you all think.


Today I started my 19th class since returning to school.  That’s crazy.  I’ve been in a class about 60% of the time during the last three years.  I only have one more core class after this, then it’s on to fulfilling general requirements and electives..  I’m getting there.