Buy Now & Pricing Download iMacros Search:
Home Products Purchase Service & Support Community Contact Us
 iMacros
  Product Information
Success Stories
Compare Editions
Web Image Recognition
Press Reviews
New: User Tweets :)
System Requirements
Online User Manual
  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- 2012 iOpus GmbH
| Purchase iMacros | Browser Scripting

|

Web Scraping | Web Testing |

WebBrowser Control

| Community Forums


Connect with us: Subscribe to the iMacros Newsletter Newsletter Connect with us on Facebook Facebook Connect with us on Twitter Twitter

iOpus' website status is monitored by our AlertFox product: Hosted server monitoring, powered by iMacros web testing technology.

Website Monitoring