Sign in to follow this  
Followers 0
meo

Help for nagivate function in IE object

7 posts in this topic

My autoit code follows:

-------------------------------------------------------------------------------

$include <IE.au3>

$oIE=_IECreate("about:blank")

$header="Content-Type: application/x-www-form-urlencoded" & @CRLF

$postdata="abc=123&de=45"

$packingArray=PackingPostData($postdata)

$oIE.Navigate("http://somewhere.com/post", 0, "", $packingArray, $header)

Func PackingPostData($postcontent)

$count=StringLen($postcontent)

Local $pack[$count]

For $i=1 To $count

$ch=StringMid($postcontent, $i, 1)

If $ch=" " Then $ch="+"

$pack[$i-1]=Asc($ch)

Next

Return $pack

EndFunc

---------------------------------------------------------------------------------

But the tracking result is, the post data is nonmeanful characters.

Can anyone kindly tell me the right $packingArray?

Thank you!

Share this post


Link to post
Share on other sites



i'm not sure i'm understanding... your for loop is just to change spaces to pluses right? eliminate that loop and look at StringReplace()


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

My packingPostData is modified from Vb (http://support.microsoft.com/kb/167658) as follows:

Private Sub PackBytes(ByteArray() As Byte, ByVal PostData As String)

iNewBytes = Len(PostData) - 1 ' Get rid of the null termination

If iNewBytes < 0 Then

Exit Sub

End If

ReDim ByteArray(iNewBytes)

For i = 0 To iNewBytes

ch = Mid(PostData, i + 1, 1)

If ch = Space(1) Then

ch = "+"

End If

ByteArray(i) = Asc(ch)

Next

End Sub

Share this post


Link to post
Share on other sites

Its customary to give a brief desciption of what you code is supposed to do.

Try

For $i=0 To $count

Also look at

_INetExplorerCapable() UDF function

Length(0 To $count) = $count + 1

_INetExplorerCapable() uses: 1 To $count

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

here's the function you're translating with extra explanations, and a little condensing

Private Sub PackBytes(ByteArray() As Byte, ByVal PostData As String)'sub is passed an array of bytes, and a string
'condensing the next 4 lines to one that does the same thing as the only way newbytes will be less than 0 is if the len of Postdata is 0
If Len(PostData)>0 Then iNewBytes = Len(PostData)-1 Else Exit Sub
      ReDim ByteArray(iNewBytes)'why take an array as a parameter and then destroy it's data with a redim?
      Replace(PostData," ","+")'the condition in the loop is unnecessary when you can do it all at once
      For i = 0 To iNewBytes'now the loop just does one thing that is adds the ascii value of the character at each position to the array
      ch = Mid(PostData, i + 1, 1)
       ByteArray(i) = Asc(ch)
      Next
    End Sub'then it's done

so if i were to do this in autoit...

func PackBytes($PostData);silly to bring in an argument then destroy it's value, so will just make my own inside to make the function monadic
If StringLen($PostData=0) Then Exit Func
$PostData=StringReplace($PostData," ",Chr(43));spaces are pluses
$ByteArray=StringToAsciiArray($PostData);array of ascii values from your string
End Func

***edit*** forgot to have the exit if length is 0 condition in the translation, so it went from 4 lines to 5

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Just find a decrisption in IE UDf

till now, autoit can not post data with IE object.

Thank JohnOne and cameronsdad for your attention.

; Name...........: __IENavigate

; Description ...: ** Unsupported version of _IENavigate (note second underscore in function name)

; ** Last 4 parameters insufficiently tested.

; ** - Flags and Target can create new windows and new browser object - causing confusion

; ** - Postdata needs SAFEARRAY and we have no way to create one

; Directs an existing browser window to navigate to the specified URL

; Parameters ....: $o_object - Object variable of an InternetExplorer.Application, Window or Frame object

; $s_Url - URL to navigate to (e.g. "http://www.autoitscript.com")

; $f_wait - Optional: specifies whether to wait for page to load before returning

; 0 = Return immediately, not waiting for page to load

; 1 = (Default) Wait for page load to complete before returning

; $i_flags - URL to navigate to (e.g. "http://www.autoitscript.com")

; $s_target - target frame

; $spostdata - data for form method="POST", non-functional - requires safearray

; $s_headers - additional headers to be passed

Share this post


Link to post
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
Sign in to follow this  
Followers 0