Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Cycle between bases in Programming Calculator mode Apps
I use the Programming mode in Calculator.app and often find myself moving to the mouse to switch between octal, hex, and decimal modes. I wrote the two following Applescripts to cycle forward and backward between bases and use Butler to bind them to Command+D and Command+Shift+D.

Cycle forwards:
tell application "System Events"
  tell application process "Calculator"
    repeat with i from 1 to 3
      if the value of radio button i of radio group 1 of group 2 of window "Calculator" is 1 then
        click radio button ((i mod 3) + 1) of radio group 1 of group 2 of window "Calculator"
        exit repeat
      end if
    end repeat
  end tell
end tell
Cycle backwards:
tell application "System Events"
  tell application process "Calculator"
    repeat with i from 1 to 3
      if the value of radio button i of radio group 1 of group 2 of window "Calculator" is 1 then
        if i is equal to 1 then
          set n to 3
        else
          set n to i - 1
        end if
        click radio button n of radio group 1 of group 2 of window "Calculator"
        exit repeat
      end if
    end repeat
  end tell
end tell

[crarko adds: I tested this (on 10.7.1), and it works as described.]
    •    
  • Currently 3.17 / 5
  You rated: 1 / 5 (6 votes cast)
 
[3,557 views]  

Cycle between bases in Programming Calculator mode | 0 comments | Create New Account
Click here to return to the 'Cycle between bases in Programming Calculator mode' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.