Quantcast
Channel: Objective Development Forums
Viewing all articles
Browse latest Browse all 4524

Re: Currency conversion

$
0
0
Bring up this script in LB
Press space
Enter your query in the format: <number><firstcurrency><space><secondcurrency>
Example: 15gbp thb

on handle_string(theInput)
   try
      set AppleScript's text item delimiters to " "
      set theFirstCurrency to text item 1 of theInput as text
      set theSecondCurrency to text item -1 of theInput
      set theURL to quoted form of ("http://www.google.com/ig/calculator?hl=en&q=" & theFirstCurrency & "=?" & theSecondCurrency)
      set theSource to do shell script "curl " & theURL
      set AppleScript's text item delimiters to ":"
      set thethird to text item 3 of theSource
      set AppleScript's text item delimiters to ","
      set thethird to text item 1 of thethird
      tell application "LaunchBar"
         set theMessage to theFirstCurrency & "= " & thethird
         set selection as text to theMessage
         display in large type theMessage
      end tell
   end try
end handle_string

Viewing all articles
Browse latest Browse all 4524