Jump to content

How to manipulate results of an IE form post?


Recommended Posts

Good afternoon, all. I am brand new to scripting, in general, so please forgive my ignorance. I have searched, in vain, through the help file, the internet, Google Groups, this forum, etc. I cannot find relative information... I have the following dilemma:

At my job, we are sent information that is encrypted, by our customers. There is a page, on our intranet, that is used to Decrypt it. The body of the page consists of three objects:

1) The text (encrypted) input field.

2) The Decryption submission button (input type = "submit")

3) The results (Decrypted) text output.

Here is my script, thus far:

#include <IE.au3>

$oIE = _IECreate ("https://{DecryptURL}")

$oForm = _IEFormGetObjByName ($oIE, "{FormName}")

$oInput = _IEFormElementGetObjByName ($oForm, "{TextInputControlName"})

$oSubmit = _IEFormElementGetObjByName ($oForm, "{DecryptButtonName}")

$oResult = _IEFormElementGetObjByName ($oForm, "{OutputTextField}")

_IEFormElementSetValue ($oInput, ClipGet())

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

This is beautiful, up to this point (1.5 sec. average). However, none of the Declarations that I make seem to make the "_IEFormElementGetValue" usable, for the output control. Additionally, I would like to select the first six lines of the output, and output it to the clipboard. The "ClipPut" function continues to elude my currently-feeble grasp on Declare-Implement-Use... Is there a method toward which someone can point me that might allow me to reach my goal? I would greatly appreciate any suggestions. I would like to figure out the code and syntax, for myself, if possible (always sticks better that way), but if someone might be able to offer me a little guidance, in this respect, I would greatly appreciate it. I am not opposed to doing my own footwork (and frown on the lazy). But every effort I have made and turned up fruitless, and I am getting a bit discouraged. The help file (since I am so inexperienced) is a little vague; or perhaps my ignorance and inexperience leads me to the wrong conclusion. In either case, I am relatively certain that the trouble lies in the way I have tried to access the results:

********************************************************

#include <IE.au3>

$oIE = _IECreate ("https://{DecryptURL}")

$oForm = _IEFormGetObjByName ($oIE, "{FormName}")

$oInput = _IEFormElementGetObjByName ($oForm, "{TextInputControlName"})

$oSubmit = _IEFormElementGetObjByName ($oForm, "{DecryptButtonName}")

$oResult = _IEFormElementGetObjByName ($oForm, "{OutputTextField}")

_IEFormElementSetValue ($oInput, ClipGet())

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

_IEFormElementGetValue ($oResult, ClipPut())

The above, when run, results in the following error:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\0\Scripting\AutoIt\Decrypt.au3"

C:\0\Scripting\AutoIt\Decrypt.au3 (15) : ==> Incorrect number of parameters in function call.:

_IEFormElementGetValue ($oResult, ClipPut())

^ ERROR

What am i missing, with respect to parameters?

********************************************************

Am I missing a step? I tried Declaring the results field AFTER submitting, as follows:

#include <IE.au3>

$oIE = _IECreate ("https://{DecryptURL}")

$oForm = _IEFormGetObjByName ($oIE, "{FormName}")

$oInput = _IEFormElementGetObjByName ($oForm, "{TextInputControlName"})

$oSubmit = _IEFormElementGetObjByName ($oForm, "{DecryptButtonName}")

_IEFormElementSetValue ($oInput, ClipGet())

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

$oResult = _IEFormElementGetObjByName ($oForm, "{OutputTextField}")

_IEFormElementGetValue ($oResult, ClipPut())

But to no avail:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\0\Scripting\AutoIt\Decrypt.au3"

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

C:\0\Scripting\AutoIt\Decrypt.au3 (15) : ==> Incorrect number of parameters in function call.:

_IEFormElementGetValue ($oResult, ClipPut())

^ ERROR

Can someone offer me a boot toward the correct method, please?

Link to comment
Share on other sites

Look this function up in the helpfile... _IEFormElementGetValue

You can do this:

$string = _IEFormElementGetValue($oResult)

ClipPut($string)

or

ClipPut(_IEFormElementGetValue($oResult))

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...