Get-Exchange-Rate.vbs

From iMacros
Jump to: navigation, search

This script calls demo macro Wsh-Extract-Rate in tray mode. It extracts exchange rate information and displays it to the user.

The same demo is also available as Visual Basic 6 (VB6) and C++ example. Please see "visualbasic-example.exe" in the iMacros example directory.

 
' iMacros Get-Exchange-Rate Script
' (c) 2008-2015 iOpus/Ipswitch Inc.  

Option Explicit

Msgbox ("This example will retrieve the current exchange rate for US$, EURO and GBP. This macro will run in the system tray.")

' find current folder
Dim myname, mypath
myname = WScript.ScriptFullName
mypath = Left(myname, InstrRev(myname, "\"))

Dim iim1, iret, iplay
set iim1= CreateObject ("imacros")

iret = iim1.iimOpen ("")
iret = iim1.iimDisplay("Extract Example")
iplay = iim1.iimPlay(mypath & "Macros\wsh-extract-rate.iim")

Dim s

If iplay = 1 Then
     s = "One US$ costs " + iim1.iimGetExtract(1) + " EURO or " + iim1.iimGetExtract(2) + " British Pounds (GBP)"
 else
     s = "The following error occurred: " + iim1.iimGetErrorText()
End If

MsgBox s

iret = iim1.iimClose
WScript.Quit(iret)


Macro code for Wsh-Extract-Rate:

TAB T=1     
TAB CLOSEALLOTHERS   
URL GOTO=http://demo.imacros.net/Automate/ExtractDemo
'Get the values
TAG POS=39 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=40 TYPE=TD ATTR=TXT:* EXTRACT=TXT