Buy Now & Pricing Download iMacros Search:
Home Products Purchase Service & Support Partner Programs Contact Us
 iMacros
  Product Information
Success Stories NEW
Compare Editions
Web Image Recognition
Press Reviews NEW
System Requirements
Online User Manual
Product Flyer (PDF)
  Support
Online Demos
Code Samples
Tutorials
iMacros User Forum
  FAQ
  Buy iMacros
  Customer Login
  Support Ticket
   
 
   
   
Home > iMacros >
VBS Sample Code

Click here to download this VBS file (This file is part of the iMacros Trial version)

'Note: EXTRACT requires Internet Explorer 6.0 or better to be installed
'Note: Technically this script is simliar to the "Get-Exchange-Rate.vbs" script

Msgbox ("This example will retrieve the response time measured with the DEMO-STOPWATCH macro.")
dim ResponseTimeArray

set iim1= CreateObject ("InternetMacros.iim")

iret = iim1.iimInit ("")
iret = iim1.iimDisplay("Get Response Times Example")
iret = iim1.iimSet("", "")
iplay = iim1.iimPlay("demo-stopwatch")
msgbox cstr(iplay)
data = iim1.iimGetLastExtract()
errortext = iim1.iimGetLastError()

msgbox data

If iplay < 0 Then
s = "The following error occurred: " + vbCrLf + vbCrLf + errortext
MsgBox s
MsgBox "Now trying to analyze extracted values...."
End If

'Get extracted text. Try to use extracted text even if macro had an error.This can be useful to find out
'what triggered the error. Example: Slow reponse times may lead finally to a macro timeout.

if instr (data, "[EXTRACT]")> 0 then
ResponseTimeArray= Split(data, "[EXTRACT]")
s = "Measured Response Times: " +vbcrlf+vbcrlf +vbcrlf
if ubound (ResponseTimeArray)> -1 then s =s+ "Intial page load time: " + ResponseTimeArray(0) + " Seconds (ID Firstpage)" +vbcrlf +vbcrlf
if ubound (ResponseTimeArray)> 0 then s =s+ "Form 1 submit time: " + ResponseTimeArray(1) + " Seconds (ID SubmitData)" +vbcrlf +vbcrlf
if ubound (ResponseTimeArray)> 1 then s =s+ "Online store form load time: " + ResponseTimeArray(2) + " Seconds (ID Store1)" +vbcrlf +vbcrlf
if ubound (ResponseTimeArray)> 2 then s =s+ "Online store form submit time: " + ResponseTimeArray(3) + " Seconds (ID Store2)" +vbcrlf+vbcrlf +vbcrlf
if ubound (ResponseTimeArray)> 3 then s =s+ "Overall macro run time: " + ResponseTimeArray(4) + " Seconds (ID total)"
MsgBox s
else
MsgBox "No data extracted. This case should not happen unless there is no EXTRACT command in the macro, the error occurred before the first EXTRACT command was reached or browser was terminated."
End If

iret = iim1.iimExit
WScript.Quit(0)

 


 
 
 
©2000-2009 iOpus Inc., Pat. Pending
| Search Website | Purchase iMacros | Community Forums | Subscribe to iOpus News
 

Site performance and uptime monitored by AlertFox Website Monitoring -> View our current performance.
AlertFox's unique web transaction monitoring is powered by iMacros Web Test Automation.