PHP:
Code:
So far, the only way to achieve this without going to System Preferences every time you switch between your Trackpad and mouse was to install Scroll Reverser, a free app that sits in your menu bar and offers you more settings than Lion's default preferences. Unfortunately, Scroll Reverser is very buggy and constantly temporarily switches between scrolling orientations for no apparent reason. I found it to be even more annoying than manually switching the direction in System Preferences.
Since there is still no perfect solution to achieve natural scrolling only with your Trackpad without going to System Preferences every time, I decided to make my own using AppleScript and MarcoPolo.
Here's a tutorial on how to do it.
Natural scrolling only with Trackpad
Step 1 : Enabling access for assistive devices
To let the AppleScripts toggle your System Preferences settings, you will first need to enable access for assistive devices.
To do so, go in System Preferences -> Universal Access and check "Enable access for assistive devices".

You will need to save two AppleScripts: one to enable Natural scrolling, the other to disable it.
Open the AppleScript Editor application located in /Applications/Utilities. Paste the following code in it:
Code:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Trackpad"
click radio button 2
if value of checkbox 1 is 1 then
click checkbox 1
end if
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell

Now you will need to create another AppleScript with this code:
Code:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell
tell application "System Events"
tell application process "System Preferences"
tell tab group 1 of window "Trackpad"
click radio button 2
if value of checkbox 1 is 0 then
click checkbox 1
end if
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
Step 3 : Installing and configuring MarcoPolo
MarcoPolo is a freeware that will allow to detect whenever a mouse is plugged or unplugged in order to automatically run the AppleScripts we just made when necessary.
Download MarcoPolo from its official website by scrolling and clicking on "MarcoPolo-2.5.dmg (Universal Binary)".
Install it by dragging it in your /Applications folder.
Open it and an its icon should appear in your menu bar. Click on it and select "Preferences...".

Go in the "Contexts" tab and add two contexts named "Mouse is plugged" and "Mouse is unplugged" respectively. Delete the default "Automatic" context.

Go in the "Rules" tab and add a USB Rule. Select "Apple Internal Keyboard / Trackpad [Apple, Inc.]", choose the context "Mouse is unplugged", set the confidence at 100% and click OK.
Next, add another rule (either USB or Bluetooth depending on your mouse) for the presence of your mouse. Make sure your mouse is connected when you do this step and select it in the list, then choose the context "Mouse is plugged", set the confidence at 100% and click OK. If you have multiple mice (home, work, etc.), add separate rules for each.

Create a second Open action with your "mouseUnplugged" AppleScript with the context "Mouse is unplugged".

Step 4 : Launching MarcoPolo on startup and hiding the menu bar icon
Go to System Preferences -> Users and Groups. Click the on the "Login Items" tab and click on the "+" sign. Locate MarcoPolo in your /Applications folder an click Add. Close System Preferences.
If you would like to hide the MarcoPolo icon from your menu bar, click on it and on "Preferences..." and check the "Hide from status bar" checkbox in the "General" tab. MarcoPolo will now be permanently hidden unless you go open in from your /Applications folder.
And that's it! MarcoPolo will now be 100% transparent and launch at startup. Natural scrolling will toggle automatically every time you plug/unplug your mouse without requiring any manual toggling.