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_CureURL

( 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_CureURL.txt . )



#####################################################################
# SCRIPT: SS_CureURL
#
# This script takes a URL and removes extraneous portions from it,
# such as /./
#
# This script writes the cured URL to output.
#
# The input URL is passed with FVA for str variable $URL.
#
# This script can be stored, and edited as needed, in a file called
# SS_CureURL.txt. The script can then be called as
#
# script SS_CureURL.txt URL("http://www.mycompany.com/./index.html")
#
#####################################################################

# Declare FVA variables.
var str URL

var str preStr
var str postStr

# Replace each instance of /./ to /
while ( { sen "^/./^" $URL } > 0 )
do
stex "]^/./^" $URL >$preStr
stex "^/./^[" $URL >$postStr
set $URL = $preStr+"/"+$postStr
done

# Replace each instance of // to /
# (We will replace the resulting ":/" to "://" at the end.)
while ( { sen "^//^" $URL } > 0 )
do
stex "]^//^" $URL >$preStr
stex "^//^[" $URL >$postStr
set $URL = $preStr+"/"+$postStr
done

# Replace the first instance of ":/" (after http, ftp, etc) to "://"
if ( { sen "^:/^" $URL } > 0 )
do
stex "]^:/^" $URL >$preStr
stex "^:/^[" $URL >$postStr
set $URL = $preStr+"://"+$postStr
done
endif

# Translate %20 to space.
while ( { sen -r "^%20^" $URL } > 0 )
do
stex "]^%20^" $URL > $preStr
stex "^%20^[" $URL > $postStr
set $URL = $preStr+" "+$postStr
done

# If this URL has a mailto: in it, this is not a good URL.
if ( { sen -c "^mailto:^" $URL } == 0 )
echo $URL
endif

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.