display dialog "Make sure your distance to convert its written down on the calculator app before going any further." with title "Distance Converter" buttons {"mi to km", "km to mi", "Cancel"}
set the button_pressed to the button returned of the result
if the button_pressed is "mi to km" then
tell application "Calculator" to activate
tell application "System Events"
keystroke "*5280/3.280839895/1000" --MILES TO KILOMETERS FORMULA
key code 36
keystroke "c" using command down
end tell
else if the button_pressed is "km to mi" then
tell application "Calculator" to activate
tell application "System Events"
keystroke "*1000*3.280839895/5280" --KILOMETERS TO MILES FORMULA
key code 36
keystroke "c" using command down
end tell
end if
Easily convert miles to kilometers and kilometers to miles with a precision up to 14 decimal places.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.