Jump to content

_IEFormElementSetValue() question


Recommended Posts

Heres the code I have so far (the relevant part anyway)

$Title = FileOpen("Topic.txt",0)


  $oFrmItm_Btn01 = _IETagNameGetCollection($oIE, "INPUT"); Get all tags that are of type "INPUT"
        $iInputCnt = @extended
        
If $iInputCnt Then
            For $Input In $oFrmItm_Btn01; For each $Input found in the $oFrmItm_Btn01 collection,
                If $Input.type = "text"  And $input.name = "msg_title"  Then; if they match the following criteria
                    _IEFormElementSetValue($Input,$Title); inputs message title
                    $binFlag = True; set the flag
                    ExitLoop; and bail out of the loop
                EndIf
            Next
EndIf

What I'm trying to do is have _IEFormElementSetValue($Input,$Title) put the text from the file topic.txt in. I really dont want to have to open the au3 file everytime I want to change the text, seems better to just have a text file that you modify before running the script.

The glass is neither half empty nor half full, it is simply twice as big as it needs to be.
Link to comment
Share on other sites

Rather then starting a new topic I'll just add to this one.

For some reason my iterations are messing up.

when I do For 1 to $max step 1

$oIE =_IENavigate($oIE,$handle[$i])

the script goes to everyone other link in the following array.

when I change the step size to .5 it does 2 skips one does 2 skips one and so on.

when I change the step size to .25 it does 4 skips 2 and repeats.

[0]|30
[1]|http://forums.d2jsp.org/index.php?showuser=230548
[2]|http://forums.d2jsp.org/index.php?showuser=212380
[3]|http://forums.d2jsp.org/index.php?showuser=162399
[4]|http://forums.d2jsp.org/index.php?showuser=233122
[5]|http://forums.d2jsp.org/index.php?showuser=278748
[6]|http://forums.d2jsp.org/index.php?showuser=299656
[7]|http://forums.d2jsp.org/index.php?showuser=356621
[8]|http://forums.d2jsp.org/index.php?showuser=377743
[9]|http://forums.d2jsp.org/index.php?showuser=271911
[10]|http://forums.d2jsp.org/index.php?showuser=129227
[11]|http://forums.d2jsp.org/index.php?showuser=265290
[12]|http://forums.d2jsp.org/index.php?showuser=210539
[13]|http://forums.d2jsp.org/index.php?showuser=217185
[14]|http://forums.d2jsp.org/index.php?showuser=256270
[15]|http://forums.d2jsp.org/index.php?showuser=212527
[16]|http://forums.d2jsp.org/index.php?showuser=230548
[17]|http://forums.d2jsp.org/index.php?showuser=297705
[18]|http://forums.d2jsp.org/index.php?showuser=303702
[19]|http://forums.d2jsp.org/index.php?showuser=306003
[20]|http://forums.d2jsp.org/index.php?showuser=254163
[21]|http://forums.d2jsp.org/index.php?showuser=373420
[22]|http://forums.d2jsp.org/index.php?showuser=358567
[23]|http://forums.d2jsp.org/index.php?showuser=319598
[24]|http://forums.d2jsp.org/index.php?showuser=319346
[25]|http://forums.d2jsp.org/index.php?showuser=258068
[26]|http://forums.d2jsp.org/index.php?showuser=302179
[27]|http://forums.d2jsp.org/index.php?showuser=381449
[28]|http://forums.d2jsp.org/index.php?showuser=191109
[29]|http://forums.d2jsp.org/index.php?showuser=380026
[30]|

I'm pretty stuck here. I just want it to go from 2 to 29 in steps of 1.

The glass is neither half empty nor half full, it is simply twice as big as it needs to be.
Link to comment
Share on other sites

Two ways:

; First method:
For $i = 1 to UBound($handle) - 2
    $oIE =_IENavigate($oIE,$handle[$i])
    ; Do something with $oIE...
Next

; Second method:
For $i = 1 to 29
    $oIE =_IENavigate($oIE,$handle[$i])
    ; Do something with $oIE...
Next

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I get the same result. I think it has something to do with the array $handle

heres the entire script.

#include <IE.au3>
#include <File.au3>
#include <Array.au3>


Dim $handle
Dim $Title
Dim $Msg

FileOpen("Topic.txt",0)
$Title = FileRead("Topic.txt")
FileClose("Topic.txt")
FileOpen("Msg", 0)
$Msg = FileRead("Msg.txt")
FileClose("Topic.txt")
$oIE = _IECreate ("http://forums.d2jsp.org/")
;~ WinWaitActive("d2jsp Forums - Microsoft Internet Explorer")

;~ WinSetState("", "", @SW_MAXIMIZE)
_IELinkClickByText($oIE,"d2jsp forums")
Sleep(500)
_IELinkClickByText ($oIE, "My guild")

FileOpen("test.txt",2)
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
For $oLink In $oLinks
    If StringInStr($oLink.href,"http://forums.d2jsp.org/index.php?showuser=") Then FileWrite("test.txt",$oLink.href & @CRLF)
Next
  _FileReadToArray("test.txt",$handle)

$MaxValue = int(UBound($handle,1)-1 )
;~ _ArrayDisplay( $handle)
;~ MsgBox(4096,"",$MaxValue)


For $i = 2 to 29
    $oIE =_IENavigate($oIE,$handle[$i])


            
$oIE = _IECreate ($handle[$i], 0)

;~      $oIE =_IENavigate($oIE,$handle[$i])
            
;~          WinSetState("", "", @SW_MAXIMIZE)
           _IEImgClick ($oIE, "chat.gif", "src")
            

$binFlag = False
        $oFrmItm_Btn01 = _IETagNameGetCollection($oIE, "INPUT"); Get all tags that are of type "INPUT"
        $iInputCnt = @extended
        
If $iInputCnt Then
            For $Input In $oFrmItm_Btn01; For each $Input found in the $oFrmItm_Btn01 collection,
                If $Input.type = "text"  And $input.name = "msg_title"  Then; if they match the following criteria
                    _IEFormElementSetValue($Input,$Title); inputs message title
                    $binFlag = True; set the flag
                    ExitLoop; and bail out of the loop
                EndIf
            Next
EndIf
        
        $oFrmItm_Btn02 = _IETagNameGetCollection($oIE, "TEXTAREA"); Get all tags that are of type "INPUT"
        $iTextAreaCnt = @extended
        
If $iTextAreaCnt Then
            For $Tarea In $oFrmItm_Btn02; For each $Input found in the $oFrmItm_Btn02 collection,
                If $Tarea.name = "post" Then; if they match the following criteria
                    _IEFormElementSetValue($Tarea, $Msg); inputs message title
                    $binFlag = True; set the flag
                    ExitLoop; and bail out of the loop
                EndIf
            Next
EndIf
          $oFrmItm_Btn03 = _IETagNameGetCollection($oIE, "INPUT"); Get all tags that are of type "INPUT"
        $iInputSnd = @extended
        
If $iInputSnd Then
    
            For $Send In $oFrmItm_Btn03; For each $Input found in the $oFrmItm_Btn01 collection,
                If $Send.type = "submit"  And $Send.name = "submit"  Then; if they match the following criteria
                    _IEAction($Send,"click")
; inputs message title
                    $binFlag = True; set the flag
                    ExitLoop; and bail out of the loop
                EndIf
            Next
EndIf
    Sleep(1000)
    $WT = WinGetTitle("")
;~  WinClose($WT)
            $i = $i + 1
            Sleep(1000)
Next
The glass is neither half empty nor half full, it is simply twice as big as it needs to be.
Link to comment
Share on other sites

OK, when you get to this part, you are already pretty confused:

_FileReadToArray("test.txt", $handle)

$MaxValue = Int(UBound($handle, 1) - 1)

For $i = 2 To 29
    $oIE = _IENavigate($oIE, $handle[$i])

    $oIE = _IECreate($handle[$i], 0)

    _IEImgClick($oIE, "chat.gif", "src")

    ; ...

NextoÝ÷ ÙFèºwkz۫Ƨ{^êì¢ØZµÊ'½êìâ²·ºwZÔáy×jémv)Ȩú+Qº.جÕ*-+0Y]¡ú+¶­)Þjëh×6$MaxValue = Ubound($handle) - 1oÝ÷ Ø­z÷§¶­ÊÞvéÝj{[yÆ®±ábä^iÔèºÚÊ­¶¥w¢éí}7ê§vW´jZÞiÜáh¯ó^ÆÙh¢Z±·«uÊy×è¯[a®í½{ayªëk +{*.²êÞiº.¶Ø^jºÚÊȳy8^}§-¶­Ê­è¶Ø§+pØTn§vdz(º¯z}ý¶fzë¡ý7èƱU©ny©ÝjÂ,j'b·¬­çnÖ§µ©òÁ¬+-ërÝ)޶yÊ'vÚ%jËewºÚ"µÍÜ   ÌÍÚHHÈ  ÌÍÚ[VÌHHBÈ^oÝ÷ Øì×­áh¯ó^ÆÙh¢!ɪÞÊ­¯(§Ú'jø j×·¢·²¢ç+^v+H+,yÛajÖÞ~Þ÷§ü¨º·¯z»¶,()Þ³*.¬
jø j׫zÛ«Ê{¥©z­¶´ßªãyËoj¸nWéò¢æ«zv¯­x-¢Ø^±©¦V{*.Áéí§ʭæ­yØ­¨º·§yçm¡Ú-«Lk&Þ¶¬Á¬¦jG¬Þ±éìy«­¢+Ù}¥±IQ½ÉÉä ÅÕ½ÐíÑÍйÑáÐÅÕ½Ðì°ÀÌØí¡¹±¤()½ÈÀÌØí¤ôÈQ¼ÀÌØí¡¹±lÁt´Ä($ÀÌØí½%ô}%
ÉÑ ÀÌØí¡¹±lÀÌØí¥t¤((%}%%µ
±¥¬ ÀÌØí½%°ÅÕ½Ðí¡Ð¹¥ÅÕ½Ðì°ÅÕ½ÐíÍÉÅÕ½Ðì¤(($츸¸()9á

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...