JenniC 0 Newbie Poster

I would use code like this in biterscripting.

Assume the two pages to post are "http://www.site1.com/post.asp" and "http://www.site2.com/post.asp".


Here is the code

# Script Post2.txt
# Start two sessions.
isstart s1 "site1" "Mozilla/4.0" ; isstart s2 "site2" "Mozilla/4.0"
# Connect sessions to site1 and site2.
iscon s1 "http://www.site1.com" ; iscon s2 "http://www.site2.com"
# Post forms. 
ispost s1 "post.asp" "fieldname=fieldvalue"  ; ispost s2 "post.asp" "fieldname=fieldvalue"
# Disconnect and end sessions.
isdiscon s1 ; isdiscon s2
isend s1 ; isend s2

Can do more fancy work with internet sessions. Details at http://www.biterscripting.com/helppages_automatedinternet.html .

JenniC 0 Newbie Poster

In biterscripting,

var string text, line1, c12, clast
cat "/path/to/somefile.html" > $text
# Get the first line.
lex -p "1" $text > $line1
# Get first two chars.
chex -p "2]" $line1 > $c12
# Get the last char.
chex -p "l" $line1 > $clast
# Is $c12 "EB" and $clast is NOT "Y" ?
if ($c12=="EB") AND ($clast <> "Y")
do
    # Blank out $line1
    set $line1 = ""
    # Put $line1 back into $text
    lal "1" $line1 $text > null
    # Write file back.
    echo $text > "/path/to/somefile.html"
done
endif
JenniC 0 Newbie Poster

not all image urls are going to start with the <img tag

But they are enclosed in <img ... > tags.

# Script ImgSrc.txt
var str file, doc, img, src
# Get XML into a string variable.
cat $file > $doc
# Get <img ... > into a string variable.
stex -r -c "^<img&\>^" $doc > $img
# Get src="..." into a string variable.
stex -r -c "^src&=&\"&\"^" $img > $src
# Remove everything upto the first and everything after the
# last double quote.
stex -r -c "^\"^]" $src > null
stex -r -c "[^\"^" $src > null
# The source location is in $src.
echo $src

Script in biterscripting. Save it in file "C:/Scripts/ImgSrc.txt". Call it as

script "C:/Scripts/ImgSrc.txt" file("http://www...../.../file.html")

Check out the documentation for the stex, etc. commands at http://www.biterscripting.com/helppages_editors.html .


You can also automatically download the .jpg files to your computer using IS = Automatic Internet Session.

# Script DownloadJpg.txt
var str htmlfile, remotejpgfile, localjpgfile
# Start internet session.
isstart a
# Connect session to server
isconnect a "http://www........com"
# Use the previous script to get img src.
script "C:/Scripts/ImgSrc.txt" file("http://www........com/.../file.html") > remotejpgfile
# Get local file name
stex -p "^/^l[" $remotejpgfile > $localjpgfile
# Download remote jpg file in binary format.
isget -b a $remotejpgfile
# Save the donloaded jpg file from session buffer to local file.
issave -b a $localjpgfile
# We are done. Disconnect and end session.
isdiscon a
isend a
JenniC 0 Newbie Poster

This biterscripting script will extract images from a page.

# Script Img.txt
var str url
var str html, img
cat $url > $html
while ( { sen -c -r "^<img&src&=&\"&\"^" $html } > 0 )
do
    stex -c -r "^<img&src&=&\"^]" $html  > null
    stex "]^\"^" $html > $img
    echo $img
done

Save the script in file C:/Scripts/Img.txt, start biterscripting, enter this command.

script "C:/Scripts/Img.txt" url("http://www.daniweb.com/forums/thread261065.html#")

It will show you images on this page. I have tested this script. It's printing this output -

/alphaimages/misc/logo/logo.gif
/alphaimages/misc/logo/usercp.gif
/alphaimages/misc/logo/donate.gif
.
.
.

JenniC 0 Newbie Poster

If you don;t want to hard code the user names john, jill, etc, here is a script that will delete all "cookies" folders from /users for all users.

# Script DeleteCookies.txt
var str folderlist, folder
cd /users
lf -r -n "*cookie*" "." ($ftype=="d") > $folderlist
while ($folderlist <> "")
do
    lex "1" $folderlist > $folder
    system -s rd "/S" $folder
done

Script is in biterscripting ( http://www.biterscripting.com ) . Copy and paste the script code into file C:/Scripts/DeleteCookies.txt. Execute it by entering the following command.

script "C:/Scripts/DeleteCookies.txt"
JenniC 0 Newbie Poster

Sounds like this has not been solved yet.

Here is a straight-forward script.

# Script LookForString.txt

# Read web page into a string variable.
var str page ; cat "http://www.somesite.com/page.html" > $page

# Is string "This text is present^" present in $page ?
if ( { sen -c ("^This text is present^") $page } > 0 )
    echo "found"
else
    echo "not found"
endif

Note that output of the command (cat "whatever") can be redirected into a string variable. "whatever" can be a local file or a web page - no difference. I think that was your main problem - how to get the contents of a web page into a string variable.

Script is in biterscripting ( http://www.biterscripting.com ). You can translate it into any language. If you make it better, please post the better version.

To try the script as is, save the script as file C:/Scripts/LookForString.txt , then enter the following command into biterscripting.

script "C:/Scripts/LookForString.txt"