Jump to content
Sign in to follow this  
BlankMind

Webpage Text Field Select

Recommended Posts

I need to select a text field on a webpage, but I didn't want to use MouseMove or Send (to send {Tab}s). I tried to use Control commands, but Au3Info doesn't shows any Control ID when I select the field. I'm using Mozilla Firefox, but I can use Internet Explorer or Opera if I have to.

Share this post


Link to post
Share on other sites

It's not the brand of browser. AutoIt will just see the webpage as 1 big control. So Control* functions are no good for this. If you know some JScript, then it could possible do some interaction with this, as AutoIt, presently cannot do it directly.

Share this post


Link to post
Share on other sites

Perhaps it could be read in from the sourcecode of the page instead of trying to interface directly with the browser window, but depending on what you get, it might be more tricky than using Send(Tab)'s. :(

Jscript might be your best option. Without using AutoIt's mouse control or Send keys, you are very limited as far as interfacing on a webpage.

One thought that just occurred to me, maybe using one of the Webpage viewer AutoIt's would give you controls you wouldn't normally have... Might be worth some investigation.

-Crim

Share this post


Link to post
Share on other sites

Interacting with the HTML of a webpage would be in my opinion probably the cleanest option. I know with the COM parts in the BETA edition there are possibly ways that without messing with HTML or JScript you can access pages. Might want to talk to ScriptKitty as he is working on some stuff relating to that.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Thank you for answers. I think I will have to use {TAB} anyway :(.

<{POST_SNAPBACK}>

Without using COM and the DOM (Document Object Model) you don't have much choice. HTML documents do not expose their structures directly to the API's that AutoIt uses.

Luckily, they are adding COM support into the current beta, so it throws those doors wide open.

If you search the forums for InternetExplorer.Application you will find many examples already. The DOM provides everything you need to both read and write very specific elements from HTML documents. You'll find a starting point here: Document Object MSDN Reference.

It is not as simple as AutoIt makes it for typical widows, but it is possible and gets easier as you work with it.

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

The easiest way is probly going to be using a series of tab type things. You can track the placement with the use of pixel searches, title changes, etc.

Basically you first determine you are on the right page, as many times you change the page and it keeps the title, so change the title before you click a page.

Next make sure that your browser is fully loaded, this can be done a few ways, but one that is pretty simple is doing a pixel search on the stopsign colors on firefox, and the Status Bar Text on IE (might have to move the mouse to the top first due to statusbar link stuff)

You can navigate on the page by finding unique text right before or after the field, do a find, esc out, and then send the tab or reverse tab to that field.

Ok, now for some other ways.

I am currently working on a few direct approaches, but until then here are a few ways to act directly.

If you have a fair knowledge of HTML forms:

Use inetget to grab the page. Take a look at the source code for that page. You can then use the form data to work directly. Example:

<form action='http://www.autoitscript.com/finder/index.php?' method='post' name=....
<input type="text" name="helpbox".......
<input type="text" name="status".......

You can submit this form by opening a browser to

http://www.autoitscript.com/finder/index.php?helpbox=help&status=yes

Note this is made up code, there is no page there.

Simple forms can be used directly by opening the page you want directly this way. You can also inetget the result.

The more complex way is using the Document Object Model.

In IE, you can do this pretty easy. I am working on Firefox atm, and they are not quite as open with the information.

Basically you still need to know a fair bit about forms.

I might post up a sample and some script for this later.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

For a quick example, here is a tiny monitor so you can see what is happening:

$ObjIE=ObjCreate("InternetExplorer.Application")
With $ObjIE
  .Visible = True
  .Navigate("http://www.autoitscript.com")

  while .ReadyState <> 4
    Sleep(50)
  wend

while 1
$body=$ObjIE.document.body.innerhtml
    tooltip("Monitor" & @crlf &stringleft($body,200),0,0)
WEnd
EndWith

When you stop IE, the script will crash and stop, I only show the first few lines of the page, but click around and you will see that the tooltip changes.

edit Gui version:

$ObjIE=ObjCreate("InternetExplorer.Application")
With $ObjIE
  .Visible = True
  .Navigate("http://www.autoitscript.com")

  while .ReadyState <> 4
    Sleep(50)
  wend
EndWith

#include <GUIConstants.au3>

GUICreate("My GUI edit",400,400,0,0); will create a dialog box that when displayed is centered

$myedit=GUICtrlCreateEdit ("First line"& @CRLF, 0,0,400,400,$ES_AUTOVSCROLL+$WS_VSCROLL)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    GUICtrlSetData ($myedit, $ObjIE.document.body.innerhtml)
    sleep(100)
Wend
Exit
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

code from SvenP converted from Westi

you can see how to change the info really quick.

Const $URL = "http://office.freenet.de/e-tools.freenet.de/login.php3?world=frn_DE&callback=http://office.freenet.de/login/office.html?isfromid=99"
$ObjIE=ObjCreate("InternetExplorer.Application")

With $ObjIE
  .Visible = True
  .Navigate($URL)
  Do
    Sleep(50)
  Until .ReadyState = 4
EndWith

With $ObjIE.document.forms("loginform")
  .username.value = "Your name"
  .password.value = "password"
  .submit
EndWith

Now if I can just get this to work in Firefox...


AutoIt3, the MACGYVER Pocket Knife for computers.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...