Script Examples

  • Updated
Download Icon Download

Basic Search with Synonyms: Save variations in search terms as scripts.

Search with Truncated Synonyms in Specific Fields: Retrieve search terms with multiple word endings or spelling variations.

Basic Loops and Writing Results: Automate repetitive commands, compile the results, and write those results to a data file that you can review later.

Retrieve Monomer RNs and then Search References: Use POLYLINK to retrieve relevant CAS Registry Numbers and then use them to search across multiple files.

Retrieve Structure RNs and then Search Patents: Upload a structure file, retrieve CAS Registry Numbers for the structure, and then perform a search for patent documents.

Discover Search Term Variations: Verify a preferred drug name, supplement the search with CAS Registry Number and synonyms, and then remove duplicates from the results.

Read Search Terms from a Data File: Read values out of data files to streamline creating queries with large numbers of known search terms.

Basic Search with Synonyms

Any search you create in STN can be saved as a script. Identifying search terms can require a significant investment of your time. Preserve the knowledge you have gained by saving the variations in scripts (or data files) that you can then re-use or share.

\* This script provided without warranty

\* Example script with synonyms

=> FILE HCAPLUS

=> S "TISSUE ADHESIVES" OR "MEDICAL ADHESIVES"\>_LNUM1

=> S "Orthopedic prosthetics" OR "Prosthetic implants"\>_LNUM2

=> S _LNUM1 AND _LNUM2\>_LNUM3

=> S _LNUM3 AND P/DT AND PY.B>=2012\>_LNUM4

 

Use “ “ quotes around terms that contain multiple words.

Note there is a character limit of 292 characters per command line.

You can group terms into multiple L-numbers and then combine the results for additional processing.

Search with Truncated Synonyms in Specific Fields

STN allows word stems and truncation variables when choosing search terms. This provides you the ability to retrieve search terms with multiple word endings or spelling variations.

\* This script provided without warranty

\* Example script with truncation

=> FILE HCAPLUS
=> S (ETCH? OR PHOTOETCH? OR CHASE# OR CHASING# OR ENCHAS? OR ENGRAV? OR PHOTOENGRAV?)/TI,AB
 
You can specify search field(s) in the query, or you can allow STN to search the file's default field(s). In this example, both the title (TI) and abstract (AB) will be searched for the terms.

Basic Loops and Writing Results

Scripts can save you time by automating repetitive commands, compiling the results, and writing those results to a data file that you can review later. This example loops through multiple years and multiple CA sections (e.g., Section 1 is Pharmacology) to monitor trends over years.

\* This script provided without warranty

\* Example script with loop and datafile

=> FILE HCAPLUS

ECHO “Enter filename to store results:”

GET _Resultsfile LABEL=”Enter name of file”

OPEN <_Resultsfile> /w

IF (_$filerror <> 0) BEGIN

ECHO “The file name specified could not be located.”

ECHO “Exiting script.”

EXIT

END

_year = 2008

_yearlimit = 2017

@YEARLOOP

=> SET RANGE =_year

IF (_year = _yearlimit) BEGIN

ECHO “Processed all years.”

EXIT

END

WRITE _year NOCR

WRITE “;” NOCR

NOCR prevents the script from jumping to a new line for each entry.

_section = 1

_sectionlimit = 81

@SECTIONLOOP

IF (_section = _sectionlimit) BEGIN

ECHO “Processed _section sections.”

GOTO @JUMP

END

=> S _section/SC

WRITE _$LANS NOCR

WRITE “;” NOCR

_section = _section + 1

GOTO @SECTIONLOOP

@JUMP

=> DEL HIS Y

_year = Year + 1

GET commands present a dialog box to the user to collect the variable information.
Optional error detection routine with ECHO messaging helps expose problems when running script.
 
 
NOCR prevents the script from jumping to a new line for each entry.
 
 
 
After searching the section number, the record count is written to the data file, and the section number is incremented.
 

Retrieve Monomer RNs and then Search References

Scripts can help make your searches more comprehensive. This example uses POLYLINK to retrieve relevant CAS Registry Numbers and then use them to search across multiple files.

\* This script provided without warranty

\* Example script with multiple files and variable search terms

=> FILE REGISTRY

\* Search known RNs to find all relevant RNs

 

=> S 24980-41-4 or 26100-51-6\>_lnum1

=> POLYLINK _lnum1\>_lnum2

=> DEL SEL Y

=> SEL _lnum2 RN

=> D SEL

 

=> QUE E1-_$ENUM\>_lnum3


\* Take RNs and search multiple files

=> FILE CAPLUS EMBASE

=> S (3D OR THREE DIMENSION? OR ADDITIVE DEPOSIT? OR BIOACTIVE INK OR BIOPRINT OR BIOADDITIVE MANUF?)/TI,AB \>_lnum4

=> S _lnum4 AND _lnum3\>_lnum5

=> S _lnum5 and (BONE OR TISSUE OR SCAFFOLD OR ORGAN OR MUSCLE OR HEART OR REGENERAT? OR IMPLANT OR CARTILAGE)\>_lnum6

=> S _lnum6 AND P/DT AND PY>=2017\>_lnum7
=> S _lnum6 NOT _lnum7\>_lnum8
=> S _lnum8 AND PY>=2017\>_lnum9
=> DUP REM _lnum9\>_lnum10

 
 
_$ENUM variable represents the last E-number and allows dynamic inclusion of all E-numbers from the EXPAND.
 
Assigning L-numbers to subsets of the results (using \>_lnum#) allows you to isolate records based on characteristics of interest, and also return to any of the answer sets for new analysis.
 

Retrieve Structure RNs and then Search Patents

Scripts can help make your searches more comprehensive. This example uploads a structure file, retrieves CAS Registry Numbers for the structure, and then uses them to perform a search for patent documents and display bibliographic answers with abstracts.

\* This script provided without warranty

\* Example script with uploaded structures

=> FILE REGISTRY

UPLOAD <reactantA>

=> S L1

=> FILE CAPLUS

=> S L2 AND P/DT

=> DIS L3 1-2 BIB ABS

 
 
 
 
 
This statement displays answers 1 and 2 from L-number 3 with the display types of Bibliography (BIB) and Abstract (ABS).

Discover Search Term Variations

Scripts can be written to assist in monitoring literature across multiple resources. This example verifies a preferred drug name, supplements the search with CAS Registry Number and synonyms, and then removes duplicates from the results.

\* This script provided without warranty

\* Example script with multiple files and variable search terms

=> FILE HCAPLUS

=> SET PLU OFF

=> SET EXPAND RENUMBER

=> SET DUPORDER FILE

ECHO “Please enter earliest Entry Date (YYYYMMDD)”

GET _Timeframe Label= “Enter earliest Entry Date in YYYYMMDD format”

 

ECHO “Please enter a drug name”

GET _CAPLUSNAME Label= “Enter drug name”

 

ECHO “Retrieving drug names from HCAplus”

=> e _CAPLUSNAME+use/ct

=> e _$ENUM+UF/CT

=> s e1-_$ENUM/BI AND ED>=_Timeframe\>_lnum2

 

ECHO “Retrieving the CAS Registry Number for your drug name”

=> FILE REGISTRY

=> S _CAPLUSNAME/CN

=> SEL RN\>_lnum3

 

=> FILE HCAPLUS

=> S (_lnum2 OR _lnum3) AND ED >=_Timeframe\>_lnum4

 

=> FILE EMBASE

ECHO “Retrieving drug names from Embase”

=> e _CAPLUSNAME+use/ct

=> s _$ENUM

=> e _$ENUM+UF/CT

=> s (e1-_$ENUM/BI OR _lnum3) AND ED>=_Timeframe\>_lnum5

 

=> FILE MEDLINE

ECHO “Retrieving drug names from Medline”

=> e _CAPLUSNAME+xuse/ct

=> s e1

=> s (e1-_$ENUM/BI OR _lnum3) AND ED>=_Timeframe\>_lnum6

 

=> FILE HCAPLUS EMBASE MEDLINE

=> s _lnum4 OR _lnum5 OR _lnum6\>_lnum7

 

=> SET PLU LOGIN

=> SET EXPAND LOGIN

=> DUP REM _lnum7\>_lnum8

 

ECHO “Enter DISPLAY command including L-number, display format (e.g., BIB ABS) and number of records (enter 1- for all)”

 
Scripts can edit user preferences such as handling plurals or restarting the E-numbers.
 
 

Read Search Terms from a Data File

Scripts can read values out of data files to streamline creating queries with large numbers of known search terms (such as CAS Registry Numbers, patent numbers or common chemical names). This example reads CAS Registry Numbers from a file and parses them into workable groups.

\* This script provided without warranty

\* Example script reads data file and groups search terms

=> FILE REGISTRY

_maxRNs = 15

_innerCount = 0

_storeSearch = “S”

_storeFinal = “S”

 

ECHO "OPEN Solvent RN file"

OPEN <SOLVENTRNS> /R

 

@MAINLOOP

READ _searchterm

ECHO “Read _searchterm”

IF _searchterm = “*****” THEN

GOTO @FINALSEARCH


_join = “”

IF _innercount > 0 _join = “OR”


_storeSearch = _storeSearch + _join

_storeSearch = _storeSearch + _searchterm

 

_innerCount = _innerCount + 1

IF _innerCount = _maxRNs THEN

BEGIN

=> _storeSearch

_innerCount = 0

_storeSearch = “S”

IF _storeFinal <> “S” THEN

BEGIN

_storeFinal = _storeFinal + “OR”

END

_storeFinal = _storeFinal + _$LNUM

END

GOTO @MAINLOOP

 

@FINALSEARCH

IF _storeSearch <> “S” THEN

BEGIN

=> _storeSearch

IF _storeFinal <> “S” THEN

BEGIN

_storeFinal = _storeFinal+ “OR”

END

_storeFinal = _storeFinal + _$LNUM

END

 

=> _storeFinal

=> D CN 1-

:Y

 

CLOSE

ECHO "Script complete"

EXIT

This script uses variables and counters to include hundreds of CAS RNs in a search query by creating groups of 15 values.
The data file has a string used to signal the end of reading search terms.
 
 
 
Here we are programmatically adding the “OR” operator between L-numbers.