writing a value to a text file after it writes it inawebform

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
steve

writing a value to a text file after it writes it inawebform

Post by steve » Fri Dec 31, 2004 9:44 pm

heres what I have so far and what I want to do with it

Dim IE
Call CreateIE
Call Navigate("http://www.fulcoram.com/test2.html")

Dim Random
Random=RDM

Dim Email
Email=Random & "@email.com"

Call WebFormFill("email",Random,submit)
Call SubmitForm()
Call KillIE

Sub CreateIE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible=1
End Sub

Sub Navigate(URL)
IE.Navigate URL
do while IE.Busy
loop
End Sub

Sub KillIE
IE.Quit
Set IE = nothing
End Sub

Sub FormSelect(fieldname,fieldvalue,submit)
Dim FormNr
Dim ItemNr
Dim TheForm

if IE.Document.All.Tags("FORM").Length = 0 then
MsgBox("No form found in page")
else
for FormNr = 0 to IE.Document.Forms.Length - 1
Set TheForm = IE.Document.Forms(FormNr)
for ItemNr = 0 to TheForm.Elements.Length - 1

if TheForm.Elements(ItemNr).Name = fieldname then
TheForm.Elements(ItemNr).selectedIndex = fieldvalue
'If submit=1 then
'end if
exit for
end if
next
next
end if
End Sub


Sub Checkbox(fieldname,fieldvalue,submit)
Dim FormNr
Dim ItemNr
Dim TheForm

if IE.Document.All.Tags("FORM").Length = 0 then
MsgBox("No form found in page")
else
for FormNr = 0 to IE.Document.Forms.Length - 1
Set TheForm = IE.Document.Forms(FormNr)
for ItemNr = 0 to TheForm.Elements.Length - 1

if TheForm.Elements(ItemNr).Name = fieldname then
TheForm.Elements(ItemNr).checked = fieldvalue
'If submit=1 then
'end if
exit for
end if
next
next
end if
End Sub


Sub WebFormFill(fieldname,fieldvalue,submit)
Dim FormNr
Dim ItemNr
Dim TheForm

if IE.Document.All.Tags("FORM").Length = 0 then
MsgBox("No form found in page")
else
for FormNr = 0 to IE.Document.Forms.Length - 1
Set TheForm = IE.Document.Forms(FormNr)
for ItemNr = 0 to TheForm.Elements.Length - 1

if TheForm.Elements(ItemNr).Name = fieldname then
TheForm.Elements(ItemNr).Value = fieldvalue
'If submit=1 then
'end if
exit for
end if
next
next
end if
End Sub

Sub SubmitForm
Dim TheForm

Set TheForm = IE.Document.Forms(1)
TheForm.Submit

End Sub

Function RDM
Randomize ' Initialize random-number generator.
' Generate random value between 1 and 999999999.
RDM = CLng((999999999 * Rnd) + 1)
End Function


this just brings up a test webform, submits a random number and then submits

but is there a way to take the random value it submitted in the form and write it to a text file using filesystemobject ?

ive tried my luck but it just writes a completely new random number inthe text file not the one it entered on the form

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts