3.1: Using the Command Line
Overview
If you've decided to use the basic edition of screen-scraper this is your only option for invoking screen-scraper externally (invoking screen-scraper from the command line is also available in the professional and enterprise editions).
You can find full documentation and examples on using the command line on our Invoking screen-scraper from the command line documentation.
Writing the External Script
In order to invoke screen-scraper from the command line, you'll need to create a batch file (in Windows) or a shell script (in Linux or Mac OS X) to invoke the scraping session.
If you have not disabled the Initialize scraping session script then please do so now. Instructions on how to do this can be found on the previous page.
Windows
If you're using Windows open a text editor (e.g., Notepad) and enter the following:
Save the batch file (call it hello_world.bat) in the folder where screen-scraper is installed (e.g., C:\Program Files\screen-scraper professional edition\).
If the version of screen-scraper you're running is prior to 4.5, and you're running Windows Vista, you will need to save your batch file to a location such as your Documents folder or your Desktop. Then, within Windows Explorer, manually transfer the file to the directory where screen-scraper is installed.
Linux
If you're running Linux, the shell script would look like this:
Save the shell script (call it hello_world.sh) in the folder where screen-scraper is installed (e.g., /usr/local/screen-scraper professional edition/).
Mac
For Mac OS X, you'd use this for the script:
Save the shell script (call it hello_world.sh) in the folder where screen-scraper is installed (e.g., /Users/username/screen-scraper professional edition/).
Running Script
Windows
Open a DOS prompt. The cmd can be opened by clicking on the Start menu, selecting the Run option (on the right), and typing cmd.
For Windows 7 just type command into the Start menu search then click on cmd.
Navigate to the screen-scraper installation directory using the cd command. It should resemble:
Once you are in the correct directory, run the file by simply typing its name into cmd:
You should see the text from screen-scraper's log appear in the DOS window.
Non-Windows Operating System
If you're running Linux or Mac OS X, you'll need to close the workbench before invoking your shell script.
Open Terminal and navigate to the screen-scraper installation directory using the cd command. One example is shown below:
Once you are in the correct directory, run the file:
Viewing the Results
As with the first tutorial and our test run, to see that the script has run open the form_submitted_text.txt file in the screen-scraper installation directory. You can also try editing the file and running it again to have it say something else. Have some fun!
- Printer-friendly version
- Login or register to post comments