Sign in to follow this  
Followers 0
diikee

SOLVED---Recalculating DOM (continuation)---SOLVED

8 posts in this topic

#1 ·  Posted (edited)

<SELECT onchange=setGainStyle(this); name=gainStyle>

<OPTION value=peakdetect selected>peakdetect</OPTION>

<OPTION value=darkdetect>darkdetect</OPTION>

<OPTION value=average>average</OPTION>

<OPTION value=clipaverage>clipaverage</OPTION>

</SELECT>

Sleep(2000)
$gs = _IETagNameGetCollection ($oIE, "select")
For $g In $gs
    If ($g.name) = "gainStyle" then 
        $gopt = _IETagNameGetCollection($g, "OPTION")
            For $gop in $gopt 
                Sleep(2000)
                Global $o = $gop.innerText
                ConsoleWrite("Gain style is: " & $o & @CRLF) 
                _IEFormElementOptionselect($g, $o, 1, "byText")
                FileWrite($file, "Gain style is: " & $o & @CRLF)
                Sleep(2000)
                $oi = _IECreate($ip, 0)
                _IELoadWait($oi)
                _IENavigate($oi, &$ip "/get.oid?1.2.8.14")
                    Sleep(3000)
                $oid = _IEAttach(&$ip "/get.oid?1.2.8.14","URL")
                    Sleep(1000)
                $gm = _IETagNameGetCollection($oid, "PRE")
                    Sleep(1000)
                For $g in $gm
                    $id = $g.innerText
                        ConsoleWrite("GainStyle is set to: " & $id & @CRLF)
                Next
                If $id = $o Then
                        ConsoleWrite("GainStyle set successfully" & @CRLF)
                    Else
                        ConsoleWrite("GainStyle set test failed" & @CRLF)
                EndIf
                        Sleep(2000)
                    WinClose($oid)
                        Sleep(1000)
                    $oIE = _IEAttach(&$ip "/imageset.html","URL") --->>This works fine but the 2nd iteration fails
                                                    
                    _IELoadWait($oIE)
                    
            Next
        ExitLoop
    EndIf
Next

Image Page Testing

Gain style is: peakdetect

GainStyle is set to: PEAKDETECT

GainStyle set successfully

Gain style is: darkdetect

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidObjectType --->>darkdetect wasn't selected

GainStyle is set to: PEAKDETECT

GainStyle set test failed

Gain style is: average

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidObjectType --->>average wasn't selected

GainStyle is set to: PEAKDETECT

GainStyle set test failed

Gain style is: clipaverage

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidObjectType --->>clipaverage wasn't selected

GainStyle is set to: PEAKDETECT

GainStyle set test failed

how can I handle this problem

Edited by diikee

Share this post


Link to post
Share on other sites



As I suggested before, for testing examine the ObjName. Change:

ConsoleWrite("Gain style is: " & $o & @CRLF)

to

_IELoadWait($oIE)

ConsoleWrite("Gain style is: " & $o & " Object Type $g = " & ObjName($g) & @CRLF)

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

Share this post


Link to post
Share on other sites

This is what I got after adding your changes

Gain style is: peakdetect Object Type $g = DispHTMLSelectElement

GainStyle is set to: PEAKDETECT

GainStyle set successfully

Gain style is: darkdetect Object Type $g =

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

GainStyle is set to: PEAKDETECT

GainStyle set test failed

Gain style is: average Object Type $g =

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

GainStyle is set to: PEAKDETECT

GainStyle set test failed

I am looking at the DispHTMLSelectElement

any more clues???

Share this post


Link to post
Share on other sites

With the information you have provided it doesn't make sense. I venture that there is other important code and behavior of the webpage that you are not sharing.

Prove this to yourself by looping through all of the elements of the $gs collection right after you create it examining ObjName and I expect they will all be DispHTMLSelectElement. If that is true, then your task is to figure out what changes between that time and when you get the error.

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

Share this post


Link to post
Share on other sites

Dale,

I looped through the selection option and yes, everything is DispHTMLSelectElement. The problem seem to be when I created the other browser ($oi) and come back to the original one ($oIE).

Gain style is: peakdetect Object Type $g = DispHTMLSelectElement

Gain style is: darkdetect Object Type $g = DispHTMLSelectElement

Gain style is: average Object Type $g = DispHTMLSelectElement

Gain style is: clipaverage Object Type $g = DispHTMLSelectElement

When I created the new browser, is there another way to get back to the older browser other than by _IEAttach???

Share this post


Link to post
Share on other sites

Dale,

I looped through the selection option and yes, everything is DispHTMLSelectElement. The problem seem to be when I created the other browser ($oi) and come back to the original one ($oIE).

Gain style is: peakdetect Object Type $g = DispHTMLSelectElement

Gain style is: darkdetect Object Type $g = DispHTMLSelectElement

Gain style is: average Object Type $g = DispHTMLSelectElement

Gain style is: clipaverage Object Type $g = DispHTMLSelectElement

When I created the new browser, is there another way to get back to the older browser other than by _IEAttach???

When you created the second instance, did you save it to a different variable? They should be something like $oIE_1 and $oIE_2, and they won't interfere with each other, you just need to specify the right one for your functions.

:)


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

Share this post


Link to post
Share on other sites

Sleep(2000)

$gs = _IETagNameGetCollection ($oIE, "select")

For $g In $gs

If ($g.name) = "gainStyle" then

$gopt = _IETagNameGetCollection($g, "OPTION")

For $gop in $gopt

Sleep(2000)

Global $o = $gop.innerText

_IELoadWait($oIE)

ConsoleWrite("Gain style is: " & $o & @CRLF)

FileWrite($file,"Gain style is: " & $o & @CRLF)

_IEFormElementOptionselect($g, $o, 1, "byText")

FileWrite($file, "Gain style is: " & $o & @CRLF)

Sleep(2000)

$oi = _IECreate($ip, 0)

_IELoadWait($oi)

_IENavigate($oi, &$ip "/get.oid?1.2.8.14")

_IELoadWait($oi)

Sleep(2000)

$oiv = _IETagNameGetCollection($oi, "XMP")

Sleep(1000)

For $oi in $oiv

$id = $oi.innerText

ConsoleWrite("GainStyle is set to: " & $id & @CRLF)

Next

Sleep(2000)

If $o = $id Then

ConsoleWrite("Gain Style: " & $o & " was set succesfully" & @CRLF)

FileWrite($file,"Gain Style: " & $o & " was set succesfully" & @CRLF)

Else

ConsoleWrite("Gain Style: " & $o & " was not set succesfully" & @CRLF)

FileWrite($file,"Gain Style: " & $o & " was not set succesfully" & @CRLF)

EndIf

WinClose($oi)

Sleep(3000)

Next

EndIf

Next

Sleep(3000)

I was able to get it going with the above function.......thanks, Dale & PsaltyDS

Share this post


Link to post
Share on other sites

;...

$oi = _IECreate($ip, 0)

;...

For $oi in $oiv

$id = $oi.innerText

ConsoleWrite("GainStyle is set to: " & $id & @CRLF)

Next

You are reusing the browser object variable to iterate something, which loses the object for you. Try using more descriptive variable names and don't reuse the same variable for multiple purposes. When your scripts get larger and more complex you will regret this habit.

:)


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

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