Jump to content

Question.


Recommended Posts

I have another question. I used the code from the example structure and it is incorrect?

; Find a #99FF99 pixel (Easy Fight) in the range 0,0-1024,768
        $coord = PixelSearch(0, 0, 1024, 768, 0x99FF99)
            Send("{END}")
        If Not @error Then
            MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])
        EndIf

Error:

Subscript used with non-Array variable.:

MsgBox(0, "X and Y are:", $coord[0]& "," & $coord[1])

MsgBox(0, "X and Y are:", $coord^ ERROR

Link to comment
Share on other sites

Someone else in the forum might be willing to help you with another method of finding your desired link... later

<{POST_SNAPBACK}>

Here's a function and an example I just wrote using COM to find and activate a link...

$ObjIE = ObjCreate ("InternetExplorer.Application")
With $ObjIE
   .Visible = True
   .Navigate ("http://www.autoitscript.com/")
   
   While .ReadyState <> 4
      Sleep(50)
   WEnd
EndWith

clickLink($ObjIE, "forum", 2)

Exit

Func clickLink($obj, $searchText, $instance = 1)
  ; clickLink( $obj, $serachText [, $instance])
  ; $obj - Object Valiable pointing to an InternetExplorer.Application object
  ; $searchText - the text displayed on the web page for the desired link to click
  ; [$instance] - if the link text occurs more than once, specify which instance you want to click (numbering starts at 1)
   $doc = $obj.document
   $links = $doc.links
   $found = 0
   For $link in $links
      $linkText = $link.outerText
      If $linkText = $searchText Then
         $found = $found + 1
         if ($found = $instance) Then
            $result = $link.click
            ExitLoop
         EndIf
      EndIf
   Next
   
EndFunc  ;==>clickLink

Enjoy!

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

C:\Documents and Settings\Shizzkabiz\Desktop\random.au3(2,51) : ERROR: ObjCreate(): undefined function.

$ObjIE = ObjCreate ("InternetExplorer.Application")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Shizzkabiz\Desktop\random.au3 - 1 error(s), 0 warning(s)

Edited by RyGoTypE
Link to comment
Share on other sites

Here's a function and an example I just wrote using COM to find and activate a link...

$ObjIE = ObjCreate ("InternetExplorer.Application")
With $ObjIE
   .Visible = True
   .Navigate ("http://www.autoitscript.com/")
   
   While .ReadyState <> 4
      Sleep(50)
   WEnd
EndWith

clickLink($ObjIE, "forum", 2)

Exit

Func clickLink($obj, $searchText, $instance = 1)
 ; clickLink( $obj, $serachText [, $instance])
 ; $obj - Object Valiable pointing to an InternetExplorer.Application object
 ; $searchText - the text displayed on the web page for the desired link to click
 ; [$instance] - if the link text occurs more than once, specify which instance you want to click (numbering starts at 1)
   $doc = $obj.document
   $links = $doc.links
   $found = 0
   For $link in $links
      $linkText = $link.outerText
      If $linkText = $searchText Then
         $found = $found + 1
         if ($found = $instance) Then
            $result = $link.click
            ExitLoop
         EndIf
      EndIf
   Next
   
EndFunc ;==>clickLink

Enjoy!

Dale

<{POST_SNAPBACK}>

How about to search a string in the web page which does not a link?
Link to comment
Share on other sites

How about to search a string in the web page which does not a link?

<{POST_SNAPBACK}>

Just do a inetget and parse the text
[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]
Link to comment
Share on other sites

Just do a inetget and parse the text

<{POST_SNAPBACK}>

Thanks for response.

But the situation is that, I need to browse to a page served by Tomcat and use "send tab" to fillin some text fields and submit. a new page would be loaded and return a status to me about the form submition. I just want to retrieve the return message when the page load complete, and then the script would continue to perform other actions.

I tried before to access the form by using COM/DOM, but it seems that the script couldn't find and fillin anything. I am sure that I had put the url and form name, field names correct.

Link to comment
Share on other sites

Thanks for response.

But the situation is that, I need to browse to a page served by Tomcat and use "send tab" to fillin some text fields and submit. a new page would be loaded and return a status to me about the form submition. I just want to retrieve the return message when the page load complete, and then the script would continue to perform other actions.

I tried before to access the form by using COM/DOM, but it seems that the script couldn't find and fillin anything. I am sure that I had put the url and form name, field names correct.

<{POST_SNAPBACK}>

If the "return message" is text, then a combination of "send tab" to fill in the form and plain old "ctrl-f" to find the text of interest might work. If the "return message" cannot be known ahead of time and therefore cannot be searched for, then try this strange option:

fill in the form

get the return in the browser

check the URL of the returned page for info that you can key off of

and/or

feed that URL to InetGet

and see if you get the same page to a file

then parse the file for the data.

later

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...