Vortex: Texis Web Script Reference Manual Version 8.00
Total Page:16
File Type:pdf, Size:1020Kb
Vortex: Texis Web Script Reference Manual Version 8.00 Thunderstone Software Expansion Programs International, Inc. July 17, 2021 Contents 1 Texis Web Script 1 1.1 Overview ........................................ ... 1 1.1.1 Directives.................................... ... 2 1.1.2 Functions..................................... 2 1.1.3 Statements .................................... 3 1.1.4 Variables ..................................... 4 1.1.5 Execution..................................... 8 1.1.6 URLSyntax ..................................... 8 1.2 VortexStatements................................ ....... 12 1.2.1 A –functiondefinition ................................ 13 1.2.2 IF, ELSE, ELSEIF – conditional execution . 18 1.2.3 SWITCH – multi-choice branch . 20 1.2.4 Variable assignment – assign values to variables . ............... 22 1.2.5 LOCAL – declare local variables . 24 1.2.6 LOOP – iterate through variables . 26 1.2.7 SQL –executeSQLstatement ............................ 28 1.2.8 DB –setdatabasepath ................................ 39 1.2.9 USER, PASS – set SQL user and password . 40 1.2.10 WHILE –conditionalloop .............................. 41 1.2.11 READLN –readfilealineatatime.......................... 42 1.2.12 WRITE –writetofile................................. 45 1.2.13 EXEC –executeprogram............................... 47 1.2.14 CAPTURE –captureoutput.............................. 52 i ii CONTENTS 1.2.15 TIMPORT – general purpose data import . 54 1.2.16 BREAK –exitloop .................................. 56 1.2.17 CONTINUE –continueloop ............................. 57 1.2.18 RETURN – return from current function . 58 1.2.19 VERB –rawoutput.................................. 60 1.3 VortexDirectives ................................ ....... 62 1.3.1 TIMEOUT –settimeout ............................... 63 1.3.2 EXPORT – retain variables across invocations . 65 1.3.3 PUTMSG – set error message actions . 69 1.3.4 ENTRYFUNC, EXITFUNC – set entry/exit functions . 71 1.3.5 USES –useamodule................................. 73 1.3.6 SCHEDULE – schedule periodic execution of script . 75 1.3.7 COOKIES – control cookie import . 78 1.3.8 STACK –setstacklimit ............................... 79 1.3.9 TRACESQL –traceSQLcalls ............................ 80 1.3.10 SQLCACHE – control SQL handle caching . 82 1.3.11 TRAP –trapsignals.................................. 83 1.3.12 ADDTRAILINGSLASH – add trailing slash to “directory” URLs . 85 1.3.13 pragma – inline compiler directive . 86 1.4 SpecialVariables ................................ ....... 92 1.4.1 $cmd ......................................... 92 1.4.2 $cmdlnargs .................................... 92 1.4.3 $errnum, $errscript, $errline etc...................... 92 1.4.4 $indexcount ................................... 92 1.4.5 $rows.min, $rows.max ............................. 92 1.4.6 $sqlresult....vars................................ 93 1.4.7 $loop ........................................ 93 1.4.8 $next ........................................ 93 1.4.9 $null ........................................ 93 1.4.10 $pathroot ..................................... 94 CONTENTS iii 1.4.11 $ret ......................................... 94 1.4.12 $ret.count .................................... 94 1.4.13 $ret.seq ...................................... 94 1.4.14 $ret.off ...................................... 94 1.4.15 $ret.err, $ret.owner, $ret.group, $ret.size,etc. .......... 94 1.4.16 $ret.code, $ret.token, $ret.msg ..................... 95 1.4.17 $sourcepath ................................... 95 1.4.18 $url ......................................... 95 1.4.19 $urlfunc, $urlext ............................... 95 1.4.20 $urlq ........................................ 95 1.4.21 $urlroot ...................................... 96 1.4.22 $userpath ..................................... 96 1.4.23 $ FILE ...................................... 96 1.4.24 $ LINE ...................................... 96 1.4.25 $ SCRIPT ..................................... 96 1.4.26 $ FUNCTION ................................... 96 1.5 BuiltinFunctions ................................ ....... 97 1.5.1 sum – return sum of variable values . 98 1.5.2 fmt, strfmt – formatted output . 100 1.5.3 fmtcp – set fmt control parameters . 116 1.5.4 fmtinfo – get fmt control parameters . 120 1.5.5 mm – enable/disable automatic hit markup . 121 1.5.6 sb – enable/disable automatic search and replace . ....... 123 1.5.7 apicp – modify Metamorph query control parameters . 124 1.5.8 apiinfo – get current Metamorph query control parameters . 135 1.5.9 sqlcp – modify low-level SQL control parameters . 136 1.5.10 pagelinks – paginate SQL results . 143 1.5.11 flush –flushoutput ................................ 149 1.5.12 header –printHTTPheader ............................ 151 1.5.13 rex, split – regular expression search . 155 iv CONTENTS 1.5.14 sandr – regular expression search and replace . 162 1.5.15 strstr, strstri – find substring in string . 164 1.5.16 substr – extract substring from string . 166 1.5.17 strcmp, strcmpi – compare strings . 167 1.5.18 strncmp, strnicmp – compare strings, fixed length . 168 1.5.19 strlen –lengthofstring .............................. 169 1.5.20 strrev –reversestring............................... 170 1.5.21 upper – convert to upper case . 171 1.5.22 lower –converttolowercase. ..... ...... ...... ..... ..... 172 1.5.23 strfold –foldstringbycase ........................... 173 1.5.24 strfoldcmp – compare strings folded by case . 174 1.5.25 sort –sortvariables................................. 175 1.5.26 uniq, uniqcount – produce unique list of values . 178 1.5.27 count – return number of variable values . 180 1.5.28 strtonum – convert string to number . 181 1.5.29 rand – generate pseudo-random number . 183 1.5.30 randpick – return pseudo-random value of a variable . 184 1.5.31 srand – seed the pseudo-random number generator . 185 1.5.32 exit –exitprogram................................. 186 1.5.33 fetch –fetchURLs................................. 187 1.5.34 submit –submitHTMLform ........................... 191 1.5.35 urlinfo – get detailed page info . 194 1.5.36 urltext, urllinks – get formatted text, URL links . 206 1.5.37 urlcp – modify URL control parameters . 207 1.5.38 urlutil – URL/network utility . 248 1.5.39 nslookup – domain name and IP address lookup . 252 1.5.40 nsinfo – get info from last name lookup . 255 1.5.41 options – print options list . 257 1.5.42 radiobutton – print radio buttons list . 259 1.5.43 checkbox – print checkbox list . 261 CONTENTS v 1.5.44 doctype – print DOCTYPE declaration . 263 1.5.45 cal – print a calendar with links . 264 1.5.46 calrule – translate a calendar rule and iterate dates . 269 1.5.47 calendar – print calendar form . 271 1.5.48 caldate – create date list from calendar submission . 273 1.5.49 clist – create comma-separated list . 274 1.5.50 slist – create Metamorph set list . 275 1.5.51 wordlist, wordcount, wordoccurrencecounts – get words and frequen- ciesfromindex.................................... 276 1.5.52 createdb –createdatabase ............................ 278 1.5.53 adminsql – execute arbitrary SQL . 279 1.5.54 loguser –loguseraccesses ............................ 281 1.5.55 userstats – get user statistics . 282 1.5.56 resetstats – reset user statistics . 283 1.5.57 abstract – generate an abstract from text . 284 1.5.58 rmcommon – remove common prefix/suffix from text . 286 1.5.59 pwencrypt – encrypt/hash password Unix-style . 287 1.5.60 encrypt –encryptdata............................... 289 1.5.61 decrypt –decryptdata............................... 290 1.5.62 readvars – read URL-encoded variables . 291 1.5.63 varinfo – get miscellaneous variable information . 293 1.5.64 getvar – get variable values . 296 1.5.65 setvar –setanamedvariable ........................... 298 1.5.66 push – push values into a variable . 299 1.5.67 pop –popvalueoffavariable ............................ 301 1.5.68 slice – get sequence of values from a variable . 303 1.5.69 vxcp – set Vortex control parameters . 305 1.5.70 vxinfo – get miscellaneous Vortex information . 314 1.5.71 hash – produce a hash or checksum for data . 320 1.5.72 geo2code – latitude/longitude encoding for regional search . 325 1.5.73 code2geo – decode latitude/longitude encoding . 327 vi CONTENTS 1.5.74 pdfxml – convert Metamorph hit to PDF markup information . 328 1.5.75 xtree – maintain sorted list of values . 331 1.5.76 profiler – assist in searching query profiles . 336 1.5.77 read –readfiles................................... 338 1.5.78 send –printrawdata ................................ 339 1.5.79 spew –printfiles................................... 340 1.5.80 sleep –sleepforawhile .............................. 341 1.5.81 sysinfo – get system-specific information . 342 1.5.82 syscp – set system-specific information . 347 1.5.83 sysutil – file and system utilities . 349 1.5.84 stat – obtain file size and attributes . 353 1.5.85 watchpath – watch a file or directory for changes . 358 1.5.86 getpid –getprocessid............................... 362 1.5.87 procexists – see if process exists . 363 1.5.88 kill – terminate or send a signal to a process . 364 1.5.89 loadavg – return system load averages . 365 1.6 XMLAPI.......................................... 366 1.6.1 Overview ...................................... 366 1.6.2 CharacterEncodings . 366 1.6.3 Treevs.StreamingAPIs . 367 1.6.4 DataTypes ..................................... 369 1.6.5 Using the xmlTree ................................. 370 1.6.6