PRODUCT






Home









Free Download








Installation Instructions





FAQ





FAQ








Ask A Question





LEARN SCRIPTING





Overview








Lesson 1








2


3


4


5








Exam





SAMPLE SCRIPTS





Computer








Internet








Administrators








Developers








Data








Miscellaneous





HELP / DOCUMENTATION





Commands








Automated Internet








Automated Editors








Sample Scripts








Precompiled Functions








System Features






  Sample Script - SS_IgnoreURL

( Some of the sample scripts may not be reproduced correctly in html because those scripts, especially web-related scripts, have html tags such as < tr > in their code.

For an accurate, copy-and-paste'able text version of this script, see SS_IgnoreURL.txt . )



#####################################################################
# SCRIPT: SS_IgnoreURL
#
# This script checks if a URL falls within a list of domains to be ignored.
# The URL to checkk is assigned using FVA (Forward Variable Assignment)
# for str variable $URL. The value of $URL is of form
# "http://www.xxx.yyy" or "http://xxx.yyy.zzz/www.../qqq.html" .
#
# The list of domains to be ignored is passed using FVA for str variabls
# $ignore_domains. The format is <domain>|<domain>|<domain> ...
# Each <domain> is in the form "http://www.abc.def" .
#
# The http:// part is necessary in both domains as well as URLs.
#
# If the URL passes the check (it is not in the ignored domains list),
# the script outputs the original URL. If it does not pass the check
# (if it IS in the list of ignored domains), it output nothing.
#
# This script can be stored, and edited as needed, in a file called
# SS_IgnoreURL.txt. The script can then be called as
#
# script SS_IgnoreURL.txt URL("<URL>") ignore_domains("<domain>|<domain>|...")
#
#####################################################################

var str URL # Name of the URL to check
var str ignore_domains # List of domains to be ignored. Domains are separated by |.

# We will change the value of $wsep to suit our purpose.
# But, we will save the original value, so we can restore it
# after we are done.
var str saved_wsep
set $saved_wsep = $wsep
set $wsep="|"

var bool found
set $found = false # We will set it to true when we find a match.

while ( ( NOT ($found) ) AND ( $ignore_domains <> "" ) )
do
# Get the next domain.
var str domain
wex -e "1" $ignore_domains > $domain

# Note we used -e in the wex command to allow for the possibility that our
# caller may have erroneously a few extra | in $ignore_domains, for example,
# "|<domain1>||<domain2>|". In that case, without the -e option, we will go
# in an infinite loop. So, we added the -e option in the wex command, and,
# going forward, we will check if $domain is empty.

if ( $domain <> "" )
do

# Is $domain part of our $URL ?
# We will create a dynamic argument for the sen command in the form ^domain^
var str sen_arg
set $sen_arg = "^"+$domain+"^"

if ( { sen -c $sen_arg $URL } > 0 )
# We found a match.
set $found = true
endif
done
endif

done

# Did we find a match ? Echo the URL only if we did not find a match.
if ( NOT ($found) )
# No match. Output the URL
echo $URL
endif

# Restore original value of $wsep.
set $wsep = $saved_wsep

2008-2014, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com. Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.