Extracting Text via API

Hi,

Until now I was using Imacros scripting interface, at the moment I am trying to create a wrapper for ui.vision to use with my scripts.

In the Imacros scripting interface there is an option to read the extract (text) from the script. My question is how can I extract text from the webpage and use it in my script?

For example:

  1. Extract Title
  2. Extract description
  3. extract url

So the return value is something like:
“[EXTRACT]Title[EXTRACT]Description[EXTRACT]url[EXTRACT]…[EXTRACT]”

Could you point me in the direction on how to achieve that?

Thank you for your help.

First to clarify: The status of a macro run (OK or error code) is returned via the first line of the log file. The calling scripts reads it. All the sample scripts here do it this way.

Now what you asked:

To return data, e. g. scraped text, back to the calling script are are two good ways:

(1) Via clipboard: In the macro, use store | your data | !clipboard and in your script get the data from the clipboard. See also Get value from inside powershell script - #2 by User9898

(2) Save the data as CSV and then - in your script - simply read the CSV file content. Note that there are two options to build the CSV: Line by line with csvSave and all at once with csvSaveArray.

See also: How to connect SQL Database?

1 Like

Hi Plankton,

thank you very much for this info.
I will try it :slight_smile: