Jump to content

How To Find Exact Spot To Type Text


Recommended Posts

I'm trying to make a script that automatically types text into specified areas. Let's say that I want some text to be typed in a forum. How do I make it "find" the location to type in the title/subject? And then, automatically find the place to type the body text into?

At first, I used send({tab}) multiple times to get to the right boxes, but after learning about opening default browsers, I learned that for each browser the tab goes to different places. So, I'm looking for a way to type $subject into the subject line of posting a post, and $post into the actualy message post of a forum. So, any way to find exact locations so it will work with any browser?

Edited by meamrussian
Link to comment
Share on other sites

I'm trying to make a script that automatically types text into specified areas. Let's say that I want some text to be typed in a forum. How do I make it "find" the location to type in the title/subject? And then, automatically find the place to type the body text into?

At first, I used send({tab}) multiple times to get to the right boxes, but after learning about opening default browsers, I learned that for each browser the tab goes to different places. So, I'm looking for a way to type $subject into the subject line of posting a post, and $post into the actualy message post of a forum. So, any way to find exact locations so it will work with any browser?

<{POST_SNAPBACK}>

alot of variables there... different web pages display things in diff places etc....one thing you could try is using inetget() to save the page locally, then parse it out to find the field names in the form, and assign the text you want to type to the specified values in the html file, then call the form's action url, or posting page from the submit button with the values you've assigned. working directly with the html locally in the background that way will eliminate alot of the inconsistencies with different browsers etc.

Link to comment
Share on other sites

alot of variables there... different web pages display things in diff places etc....one thing you could try is using inetget() to save the page locally, then parse it out to find the field names in the form, and assign the text you want to type to the specified values in the html file, then call the form's action url, or posting page from the submit button with the values you've assigned.   working directly with the html locally in the background that way will eliminate alot of the inconsistencies with different browsers etc.

<{POST_SNAPBACK}>

OK, let's say I've saved the page, and the input for the title of the new post was the following:

<td><input class="bginput" name="subject" value="" size="40" maxlength="85" tabindex="1" type="text"></td>

How would I make autoit find that and insert text into that?

<textarea name="message" id="message" rows="20" cols="60" wrap="virtual" style="width: 540px; height: 250px;" tabindex="1"></textarea>

That would be the text area

Edited by meamrussian
Link to comment
Share on other sites

OK, let's say I've saved the page, and the input for the title of the new post was the following:

<td><input class="bginput" name="subject" value="" size="40" maxlength="85" tabindex="1" type="text"></td>

How would I make autoit find that and insert text into that?

<textarea name="message" id="message" rows="20" cols="60" wrap="virtual" style="width: 540px; height: 250px;" tabindex="1"></textarea>

That would be the text area

<{POST_SNAPBACK}>

assuming that this is the only page you'll be posting to, you could parse the locally saved copy for the 'name="subject" value="" ' string, adding everything before the last " of that substring to a temporary file, then inject your subject, then continue... as far as actually submitting the form with new values etc. Once the tempfile is completely written, with your values where you want them, just save it with html extension and open it, then click submit button. or a prettier solution would be to call your browser with the submit address and the values... if you want to see an example of a similar idea, check out post #91722 (sorry i'm not a big forum user so don't know how to link directly to the thread) it's about a program i made to handle spool files displayed on a dynamic web page. i have all of the code there for how i would read in a list of spool files, put the list to a combo box, then either pull and parse or display the spool files. either of which required submitting the form without actually having the browser up on screen.
Link to comment
Share on other sites

cameronsdad, I'm still kinda new to AutoIt... I'm not sure if I understand what you said... sorry :)

<{POST_SNAPBACK}>

no problem. i may be explaining it weird too. check out this thread Dynamic Combo Box. there is some code there for a program i made that worked wtih saved web pages and forms. Edited by cameronsdad
Link to comment
Share on other sites

I'm trying to make a script that automatically types text into specified areas. Let's say that I want some text to be typed in a forum. How do I make it "find" the location to type in the title/subject? And then, automatically find the place to type the body text into?

<{POST_SNAPBACK}>

Sorry I'm late replying here -- didn't realize you were talking about working in a browser...

I'd suggest that you use the IE Automation UDF Library I'm working on.

I posted an example here that you should easily be able to adapt for your situation.

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

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