Switching to #x application in the dock
You could save one AppleScript for clicking each Dock icon:

for i in {1..9};do echo 'tell application "System Events" to tell process "Dock" to click UI element '$i' of list 1'&gt;~/Library/Scripts/Focus\ Application\ $i.applescript;done

Then use FastScripts to assign shortcuts to the scripts.

I find it easier to just assign keyboard shortcuts for applications though.