Scripts

Overview

screen-scraper has a built-in scripting engine to facilitate dynamically scraping sites and working with data once it's been extracted. Scripts can be helpful for such things as interacting with databases and dynamically determining which files get scraped at when.

Invoking scripts in screen-scraper is similar to other programming languages in that they're tied to events. Just as you might designate a block of code to be run when a button is clicked in Visual Basic, in screen-scraper you might run a script after an HTML file has been downloaded or data has been extracted from a page. For more information see our documentation on scripting triggers.

Depending on your preferences, there are a number of languages that scripts can be written in. You can learn more in the scripting in screen-scraper section of the documentation.

If you haven't done so already, we'd highly recommend taking some time to go through our tutorials in order to get more familiar with how scripts are used.

Managing Scripts

Adding

  • Select New Script from the File menu.
  • Click on the pencil and paper icon in the button bar.
  • Right click on a folder in the objects tree and select New Script.
  • Use the keyboard shortcut Ctrl-L.

Removing

  • Press the Delete key when it is selected in the objects tree.
  • Right-click on the script in the objects tree and select Delete.
  • Click the Delete button in the main pane of the script.

Importing

  • Right-click on the folder in the objects tree that you want to import the script into (other than the root folder) and select Import Into. In the window that opens, navigate to and select the script you want to import.
  • Select Import from the File menu. In the window that opens, navigate to and select the script you want to import.
  • Add the script to the import folder in screen-scraper's install directory

    If screen-scraper is running when you copy the files into the import folder they will be imported and hot-swapped in the next time a scraping session is invoked. They will also be imported if you start or stop screen-scraper.

Exporting

  • Right-click on the script in the objects tree and select Export.
  • Click the Export button in main pane of the script.