iimGetExtract

From iMacros
Jump to: navigation, search

Name change: See API enhancements for details.

Returns the contents of the !EXTRACT variable. If the last command was iimPlay and if EXTRACT is used inside a macro iimGetExtract returns the extracted text. If the EXTRACT command could not find the extraction anchor then an #EANF# (Extraction Anchor Not Found) message is returned. If there is no EXTRACT command in the macro which was just played then iimGetExtract returns an empty string ("").

If in one macro several EXTRACT commands appear then the results are separated by the string [EXTRACT]. If complete tables where extracted, adjacent table elements are separated by the string #NEXT# and ends of table rows are delimited by the string #NEWLINE#.

Syntax iMacros Browser IE Plug-in Firefox Chrome

String extract = iimGetExtract ( [int index_of_extracted_text]   )

Parameters

Since version 6 this command supports the option to return the extracted information separately, so no further parsing and splitting is required:

iimGetExtract() - returns all extracted information at once with each item separated by the string [EXTRACT]

iimGetExtract(0) - returns all extracted information at once with each item separated by the string [EXTRACT]

iimGetExtract(1) - returns 1st extracted data

iimGetExtract (2) - returns 2nd extracted data (and so on)

Examples

Display the extracted results from a macro (Visual Basic Script example):

Dim imacros, iret 
Set imacros = CreateObject("imacros") 
iret = imacros.iimInit() 
iret = imacros.iimPlay("myextractmacro") 
MsgBox "The extract was: "+ vbNewline + _ 
  imacros.iimGetExtract() 
iret = imacros.iimExit()

See Also

Related forum posts:

iimOpen, iimPlay, iimDisplay, iimExit, iimGetErrorText, iimTakeBrowserScreenshot