Focus and not use Tabs?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Shel
Newbie
Posts: 8
Joined: Mon Nov 29, 2004 1:00 pm
Location: Providence RI

Focus and not use Tabs?

Post by Shel » Fri Apr 22, 2005 4:36 pm

Thanks, problem is solved! :D
Last edited by Shel on Mon May 16, 2005 7:32 pm, edited 9 times in total.

ShaneCl
Newbie
Posts: 13
Joined: Sun Apr 24, 2005 2:18 am
Location: Toowoomba - Aust

Post by ShaneCl » Tue Apr 26, 2005 12:13 pm

Can you have the Agent ID passed to your Sub OpenPage as a Variable then have VB assign Agent ID to the form element if you dont now the element name or number use MsgBox's to diplay the elements as you loop through them.

Here is a rough example (look at Supports post called "Automate Web forms with IE"

VBSTART
Sub OpenPage(URL,Wait,ElementName,AgentID)
Dim IE
Dim FormNr
Dim ItemNr
Dim TheForm

Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate URL
do while IE.Busy and Wait
loop

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 = ElementName then
TheForm.Elements(ItemNr).Value = AgentID
exit for
end if
next
next
end if

End Sub
VBEND
Ask>Day-Rates: 1-$12 2-$24 3-$36 4 to 7-$45 8-$57 9-$69 10-$81 11-$90,continue
If>continue=YES
//open IE and navigate to the web page and enter the agent id
VBRun>OpenPage,http://www.airportvalet.com/reservation ... tName,5050
DateStamp>C:\airportparking\ID5050.txt,Yes=5050
Endif
If>continue=NO
DateStamp>C:\airportparking\ID5050.txt,No
Endif

Shel
Newbie
Posts: 8
Joined: Mon Nov 29, 2004 1:00 pm
Location: Providence RI

Post by Shel » Fri Apr 29, 2005 3:14 pm

Hi Solow, THANKS ... did you get that script to work?

I wasn't able to get the # to parse into the AgentID field, I tried your script, and then tried a few variations of with no luck.

If I could get that # to parse or send to the AgentID field by it’s (name) or just get it in the first field in the form/page I’d be thrilled.

Thanks, Shel

Shel
Newbie
Posts: 8
Joined: Mon Nov 29, 2004 1:00 pm
Location: Providence RI

Thanks

Post by Shel » Wed May 04, 2005 2:22 pm

Thanks, problem is solved.
Last edited by Shel on Mon May 16, 2005 7:33 pm, edited 1 time in total.

ShaneCl
Newbie
Posts: 13
Joined: Sun Apr 24, 2005 2:18 am
Location: Toowoomba - Aust

Post by ShaneCl » Thu May 12, 2005 9:38 am

Hi Shel

Here is the code that will place "5050" into the first Agent Id Field.


vbstart
Sub WebFormFill(LookFor,IDValue)
Dim IE
Dim FormNR
Dim ItemNE
Dim TheForm

Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate "http://www.airportvalet.com/reservation4.htm"


do while IE.Busy or Wait
loop

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 = LookFor then
TheForm.Elements(ItemNR).Value = IDValue
End IF
'*******get rid of the rems infront of the message boxs below and you
'*******will get all of the elements listed out one at a time - there are 39
'*******on your web page
'MsgBox(ItemNR)
'MsgBox(TheForm.Elements(ItemNR).Name)
'MsgBox(TheForm.Elements(ItemNR).Value)

Next
Next
End If
End Sub


vbend

VBRun>WebFormFill,AgentID,5050



Regards

shane - Solow

Shel
Newbie
Posts: 8
Joined: Mon Nov 29, 2004 1:00 pm
Location: Providence RI

Post by Shel » Mon May 16, 2005 7:35 pm

Solow29 wrote:Can you have the Agent ID passed to your Sub OpenPage as a Variable then have VB assign Agent ID to the form element if you dont now the element name or number use MsgBox's to diplay the elements as you loop through them.

Here is a rough example (look at Supports post called "Automate Web forms with IE"

VBSTART
Sub OpenPage(URL,Wait,ElementName)
Dim IE
Dim FormNr
Dim ItemNr
Dim TheForm

Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate URL
do while IE.Busy and Wait
loop

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 = ElementName then
TheForm.Elements(ItemNr).Value =
exit for
end if
next
next
end if

End Sub
VBEND
Ask>Day-Rates: ,continue
If>continue=YES
//open IE and navigate to the web page and enter the agent id
VBRun>OpenPage,http://www,1,ElementName,5050
DateStamp>C:\airportparking\ID5050.txt,Yes=5050
Endif
If>continue=NO
DateStamp>C:\ID5050.txt,No
Endif

Shel
Newbie
Posts: 8
Joined: Mon Nov 29, 2004 1:00 pm
Location: Providence RI

Can you have the Agent ID passed...

Post by Shel » Mon May 16, 2005 7:37 pm

Solow29 wrote:Can you have the Agent ID passed to your Sub OpenPage as a Variable then have VB assign Agent ID to the form element if you dont now the element name or number use MsgBox's to diplay the elements as you loop through them.

Here is a rough example (look at Supports post called "Automate Web forms with IE"

VBSTART
Sub OpenPage(URL,Wait,ElementName,AgentID)
Dim IE
Dim FormNr
Dim ItemNr
Dim TheForm

Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate URL
do while IE.Busy and Wait
loop

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 = ElementName then
TheForm.Elements(ItemNr).Value = AgentID
exit for
end if
next
next
end if

End Sub
VBEND
Ask>Day-Rates: ,continue
If>continue=YES
//open IE and navigate to the web page and enter the agent id
VBRun>OpenPage,http://,1,ElementName,5050
DateStamp>C:\airportparking\ID5050.txt,Yes=5050
Endif
If>continue=NO
DateStamp>C:\ID5050.txt,No
Endif

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