Author Topic: Currency converter lookup code  (Read 2372 times)

tony.steward

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://www.locksdownunder.com
Currency converter lookup code
« on: October 12, 2006, 06:58:04 am »
Here is my first attempt at writing any code. It is very simple and perhaps the gurus could suggest improvments.

'Search for Keywords if the User wants to convert currency.
'Example:
'User: convert currency 1 aud usd
'HAL: I have found the following conversions. HAL then Loads the converter.

If SearchAmt = "" Then SearchAmt = HalBrain.SearchPattern(OriginalSentence, "CONVERT CURRENCY * * *", 1)
If SearchFrom = "" Then SearchFrom = HalBrain.SearchPattern(OriginalSentence, "CONVERT CURRENCY * * *", 2)
If SearchTo = "" Then SearchTo = HalBrain.SearchPattern(OriginalSentence, "CONVERT CURRENCY * * *", 3)
' Currency Search form the above Currency Keyword.
If SearchAmt <> "" And SearchFrom <> "" And SearchTo <> "" Then
   SearchCurrency = "http://www.google.com/search?q=" & SearchAmt & "+" & SearchFrom & "+In+" & SearchTo & "&btnG=Google+Search"
   HalMenu.HalCommand "<RUNPROG>" & SearchCurrency & "</RUNPROG>"
             GetResponse = "I have found the following Currency Conversion "
                 HalBrain.ReadOnlyMode = True
End If