STN Express offers powerful tools for creating session strategies offline, before you connect to STN. You can create scripts that automate STN online sessions, saving you time and online costs. You can also use scripts for repetitive procedures such as an alert (SDI) that is run irregularly or a complex search strategy saved for future reference.
This article explains:
- STN Command Window scripts
- STN Script Language
- Planning your script
- Writing your script
- Creating a command file
- Checking and running your script
Command Window scripts
The STN Express Command Window is an effective tool for creating scripts for online searching. The Command Window scripts, however, are restricted to a simple list of commands that may be executed sequentially or one line at a time for the entire script. User interaction or intervention within the script is possible but not seamless.
Example:
FIL AEROSPACE
DEL HIS Y
NEWS FILE
S COMPUTER-AID?;D IALL
S FCC (L) NASA;D
S LINEAR (S) REGULATOR;D HIT
S (?SPACE?(L)CAPSULE)/AB;D AB
S 2005:33003/AN;D ALL
S US/AC;D
STN Script Language
STN Script Language gives you options for interaction, variables, decision points, and more, which the Command Window scripts do not offer. For example, you may routinely perform a certain subject or author search on STN. Rather than logging on to STN, opening a transcript file to capture search results, searching multiple files, and then logging off and reviewing the transcript, you can use STN Script Language to streamline the process. One script can log on to STN, another can initiate the searches, and another script can display the answers. Alternatively, one script can perform all three tasks. The script runs automatically, without waiting for any typing, except when requesting input.
The example in this article shows the use of STN Script Language to create an online script that expands, searches, and displays with customized user interaction. While the example script is relatively simple, much more sophisticated scripts can be written.
A summary of script language commands is presented below.
Planning your script
Steps in creating a script:
- Determine the objective.
- Identify the tasks to accomplish the objective.
- Write the commands to carry out the tasks.
- Translate the commands into script language statements.
- Determine the degree of user interaction.
- Consider any necessary commentary to explain the script.
Scripts can be written in any text editor such as Notepad or WordPad and then saved as a Text (.txt) file. Alternatively, you can create or copy/paste your script into STN Express, as described later in this article.
Writing your script
The following example illustrates the steps required to create and execute a generic author search script while also demonstrating the power of STN Script Language. This script begins at the file entry point and concludes with the display of selected answers.
- Display an introduction or commentary.
The ECHO command sends messages to the user of the script.
ECHO "This script runs an author search."
ECHO "Press Esc key to stop the script."
- Enter a database.
STN Script Language allows comment statements to accompany the commands. Each comment statement begins with a backslash followed by an asterisk (\*). Each STN command line begins with the system prompt (=> or :). The program comments are shown in bold for illustration only.
The user is asked to specify a file name for the search, and the database is entered.
ECHO ""
ECHO "In the pop-up box, enter the file name or names."
GET _filename \* The underline begins a variable
\* name. GET prompts for input
=> FIL _filename
ECHO ""
- Expand on author names.
The user is asked to specify the authors last and first name, as well as the number of lines to include in the expand (5-25).
ECHO "In the pop-up box, enter the last or family name\
of the author:" \* a backslash is used to continue
\* a line
GET _lastname
ECHO "In the pop-up box, enter first or given name\
or initial:"
GET _firstname
ECHO "In the pop-up box, enter the number of lines\
(5-25) for the expand."
GET _lines
\* Use the STN expand command to provide choices of
\* names.
=>
=> EXPAND _lastname _firstname/au _lines
- Search E-numbers or name.
The user is asked to specify E-numbers or an author name to search.
ECHO "Enter the E-numbers to search, e.g., e3-e5 or\
e3,e7), author name/AU, or end"
GET _enums
IF (_enums = "end") \* IF conditional begins exit
\* loop
BEGIN \* BEGIN starts the conditional
\* loop
ECHO "Ending author search at your request."
=>
EXIT \* EXIT terminates the script
END \* END terminates the IF loop
=>
=> SEARCH _enums \> _results \* \> _results is the
\* L-number of the answer set
\* If the search yielded zero answers, there is
\* nothing to display. Inform the user and exit.
IF (#_results = 0) \* #_results is the numbers of
\* answers in the L-number
BEGIN
ECHO "There are no answers for your query."
=>
EXIT
END
-
Display and save results.
The user is asked to specify the number of answers to display and the display format. The answers are saved in a transcript. The script is terminated.
\* The search found hits, so ask how many should be
\* displayed.
ECHO "How many answers would you like to display? (e.g.,\
#_results or 0):"
GET _display
IF (_display > 0)
BEGIN
ECHO "Please provide a transcript name to use to\
save your answers."
CAPTURE ON <> \* CAPTURE turns on transcript
\* Dont try to display more answers than are
\* available.
IF (_display > #_results) THEN _display = #_results
=>
ECHO "Please enter the display format."
GET _format
=> dis 1-_display _format
CAPTURE OFF <>
END
ECHO "Your author search is now complete."
=>
EXIT \* The script is terminated
Creating a command file in STN Express
After your script is written, use STN Express to create a command file.
- From the main menu, select Query > Prepare Command File.
- In the Open Script window, click New.
(Alternatively, you can open the .txt file where your script has been saved.)

- Create or copy/paste your text into the stnedit window.
- Save the file in Command Files (.sc) format.
Checking and running your script
To have STN Express check your script for basic errors, select Query > Check Command File.

When you are ready to run your script, log on to STN and select Query > Run Command File. As the script runs, respond to the prompts for the required parameters.
Script Language Summary
|
Command |
Action |
|
\* |
Begins comments in script |
|
\ |
Continues command statement on next line |
|
ECHO |
Sends blank line to the screen |
|
ECHO text |
Displays message text on screen |
|
GET |
Prompts user for input |
|
_filename |
Variable name; always starts with a _ (underscore) |
|
=> |
STN command prompt for STN command |
|
_$ENUM |
Predefined variable for current E-number |
|
_$LANS |
Predefined variable for number of answers in most recent L-number |
|
_$LNUM |
Predefined variable for most recent L-number |
|
IF/ELSE |
Conditional statement |
|
BEGIN/END |
Block of statements treated as a group |
|
EXIT |
Terminates the script |
More information
This article gives only a small glimpse into the power of the STN Script Language. Much more sophisticated scripts can be written.
To learn more about scripting and script language, refer to the following resources:
In particular, click References to view abstracts for the following articles:
- Neuhaus, C., Litscher, A., & Daniel, H.-D. (2007). Using scripts to streamline citation analysis on STN International. Scientometrics, 71(1), 145-150.
- Wolff, T. E. (2007). Why you should care about STN script commands. Searcher, 15(8), 40-48.
Updated: 7/24/2008 2:53:58 PM