How to post to website forms in IE w/out opening browser

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

How to post to website forms in IE w/out opening browser

Post by clickfast » Wed Jan 07, 2009 1:20 am

Hello all,

Trying to figure out how to post to website forms in IE without displaying the browser window... I've seen it done...

Any helps or tips? Thanks!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Jan 07, 2009 2:17 am

See the HELP section for the HTTPRequest> command using the POST method.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

Post by clickfast » Wed Jan 07, 2009 5:41 pm

Bob Hansen wrote:See the HELP section for the HTTPRequest> command using the POST method.
I am actually using WebRecorder to generate the script I need... however, it opens several browser windows to execute the script. this gets messy when all I'm doing is posting to a form field. I'm not requiring the script to click on any web page objects, so not convinced a browser window is required to be open to accomplish the post to form.

Here's the code from WebRecorder
// Generated by MacroScript WebRecorder 1.72
// Recorded on Wednesday, January 7, 2009, at 12:37 AM
LibLoad>IEAuto.dll,hIE
If>hIE=0
MessageModal>Could not load IEAuto.dll, make sure it is in the path or edit the LibLoad line.
Goto>end_script
EndIf

//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1

LibFunc>hIE,CreateIE,IE[0],0

LibFunc>hIE,Navigate,r,%IE[0]%,http://www.anywebsiteform.com/
LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay

LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay

Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"accountnumber"}
Let>FieldValue={"344324843"}
LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0

Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"submit"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue

LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay

LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay

LibFree>hIE
Label>end_script

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jan 07, 2009 5:45 pm

Add this line after your CreateIE line:

//Hide IE
LibFunc>hIE,ShowIE,r,IE[0],0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

Post by clickfast » Thu Jan 08, 2009 7:20 am

mtettmar wrote:Add this line after your CreateIE line:

//Hide IE
LibFunc>hIE,ShowIE,r,IE[0],0
Thanks Marcus... works like a charm...

Are there more commands like these noted somewhere ... Maybe WebRecorder help??

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jan 08, 2009 7:28 am

Yes, in the WebRecorder help.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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