Sign in to follow this  
Followers 0
phinney

_IEPropertyget Help

8 posts in this topic

For the purpose of figuring this out I'm using the help file for this command which i have posted below.

I understand what each spot is doing(or have a good enough idea to do what i want it to do in the real program) but the issue lies when you try and click something off screen. For me, I have to scroll down slightly to get to the "Submit/Reset" button on the second page that pops up when running this script. When editing this script to search for the name of that button it will simply move my mouse off screen(down by the start button)

#include <IE.au3>
$oIE = _IE_Example ("basic")
If _IEPropertyGet ($oIE, "addressbar") Then
    MsgBox(0, "AddressBar Status", "AddressBar Visible, turning it off")
    _IEPropertySet ($oIE, "addressbar", False)
Else
    MsgBox(0, "AddressBar Status", "AddressBar Invisible, turning it on")
    _IEPropertySet ($oIE, "addressbar", True)
EndIf

; *******************************************************
; Example 2 - Open a browser with the form example and get a reference to the form 
;               textarea element.  Get the coordinates and dimensions of the text area,
;               outline its shape with the mouse and come to rest in the center
; *******************************************************
;
$oIE = _IE_Example("form")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")

; Get coordinates and dimensions of the textarea
$iScreenX = _IEPropertyGet($oTextArea, "screenx")
$iScreenY = _IEPropertyGet($oTextArea, "screeny")
$iBrowserX = _IEPropertyGet($oTextArea, "browserx")
$iBrowserY = _IEPropertyGet($oTextArea, "browserY")
$iWidth = _IEPropertyGet($oTextArea, "width")
$iHeight = _IEPropertyGet($oTextArea, "height")

; Outline the textarea with the mouse, come to rest in the center
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth/2, $iScreenY + $iHeight/2)

That is the original code, which will use the mouse to outline one of the textboxes

; *******************************************************
; Example 1 - Open a browser with the basic example, check to see if the
;               addressbar is visible, if it is turn it off, if it is not turn it on
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
If _IEPropertyGet ($oIE, "addressbar") Then
    MsgBox(0, "AddressBar Status", "AddressBar Visible, turning it off")
    _IEPropertySet ($oIE, "addressbar", False)
Else
    MsgBox(0, "AddressBar Status", "AddressBar Invisible, turning it on")
    _IEPropertySet ($oIE, "addressbar", True)
EndIf

; *******************************************************
; Example 2 - Open a browser with the form example and get a reference to the form 
;               textarea element.  Get the coordinates and dimensions of the text area,
;               outline its shape with the mouse and come to rest in the center
; *******************************************************
;
$oIE = _IE_Example("form")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "submitExample")

; Get coordinates and dimensions of the textarea
$iScreenX = _IEPropertyGet($oTextArea, "screenx")
$iScreenY = _IEPropertyGet($oTextArea, "screeny")
$iBrowserX = _IEPropertyGet($oTextArea, "browserx")
$iBrowserY = _IEPropertyGet($oTextArea, "browserY")
$iWidth = _IEPropertyGet($oTextArea, "width")
$iHeight = _IEPropertyGet($oTextArea, "height")

; Outline the textarea with the mouse, come to rest in the center
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY)
MouseMove($screenx + $iWidth/2, $screeny + $iHeight/2)

This script here is slightly edited to find "submitExample" instead of "textareaExample"(so its looking for the submit button at the bottom of the page)

Changing the &iScreenX and $iScreenY to $iBrowserX and $iBrowserY in this section of the code:

MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY)
MouseMove($screenx + $iWidth/2, $screeny + $iHeight/2)

would make sence to me fixing it, but i did that and it didnt work.

I've also tried having the script scroll all the way to the bottom of the page before doing anything else, and it still doesnt do it properly

Until I can get the script to click the button that initially appears off screen, the real script im writting is stuck

Share this post


Link to post
Share on other sites



Also, If anyone knows whether or not you can have it search for a button without a "name"

Like, the example has you search for the "name" given to the specific thing so in the example Im searching for "submitExample" in the code:

<input name='submitExample' type='submit' value='Submit'>

for the real program, this is all i have to work with:

<input type='submit' value='invite'>

but it is the only button on the page and nothing else on the page has "type='submit'" on it.

I cant just mouseclick for this because:

1. I plan on releasing this so many people can do it, and with different screen sizes that wouldnt work

2. The button can move slightly depending on how wide something on the page may be...

Share this post


Link to post
Share on other sites

I spent a couple of minutes reading through your post, but it simply is not clear to me what your question is. I got to where I thought you were finally going to tell me and your statement was "it doesn't work", which tells me nothing.

Please simplify and condense.

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

Ill just write what i have for my regular script and explain what i want to do (including pictures)

The script will automatically invite people to a "cult"(usergroup) on the Site vampirefreaks.com

Opt("WinTitleMatchMode", 2)
$page=Inputbox ("Chose a page number to start on", "Please select a page number to start on", "","",250,125)
$oIE = _IECreate ("http://search.vampirefreaks.com/search_results.php?pg="&$page&"&sex=all&search_city=&search_state=&search_state2=&search_country=&range=10&zipcode=&min_age=&max_age=&sexuality=0&sortby=user_datejoined&only_pics=1&invite=cult&invite_to=OHEMGEE")
Sleep(2000)
WinActivate ("Advanced Search")
WinSetState ("Advanced Search", "", @SW_MAXIMIZE )

This code will automatically open up Internet Explorer to the link in the code (on the page you specify in the inputbox)

Website Picture

If you look at the picture, I want it to automatically click on the Invite button(boxed in red) but you must scroll down to even see it.

When using _IEPropertyget(like in the first post) it could potentially find the button and click on it, but because I have to scroll down to actually see the button the script will just attempt to move the mouse off screen(below the start menu) and just click there instead of scrolling down and then clicking on it.

HTML code for the Invite button is: <input type='submit' value='invite'> [font color=red]No "name" attribute

So, The basic question is:

How would I have the website scroll down, then click on the button instead of just attempting to click a button that is not visible on the screen by trying to send the mouse further down then physically possible to click said button.

Example Script(should work for anyone who had Autoit installed, just make a new script with it and run it)

#include <IE.au3>
$oIE = _IE_Example("form")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "submitExample")
sleep(5000)
$iScreenX = _IEPropertyGet($oTextArea, "screenx")
$iScreenY = _IEPropertyGet($oTextArea, "screeny")
$iBrowserX = _IEPropertyGet($oTextArea, "browserx")
$iBrowserY = _IEPropertyGet($oTextArea, "browserY")
$iWidth = _IEPropertyGet($oTextArea, "width")
$iHeight = _IEPropertyGet($oTextArea, "height")
MouseClick("left",$ibrowserx + $iWidth/2,$ibrowserY + $iHeight/2)

Note: This example script will click on the "Aaron" box, I want it to click on the "Submit" button below that

Share this post


Link to post
Share on other sites

The answer then is that you do not have to get the element on screen to click on it.

Use an IE funtion (like _IEGetObjById or _IETagnameGetCollection) to get a reference to the object and then use _IEAction with "click". BTW, you can use $oYourElement.scrollIntoView if you want to see it in the screen, but it is not necessary.

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

Thank you, ill give the codes a try

Share this post


Link to post
Share on other sites

one more question regarding this, as I am still having issues, many thanks for helping me thus far.

The button i want to click doesnt have a name.

<input name='submitExample' type='submit' value='Submit'>

That is what i'm talking about, in any example script you use through autoit, whatever you're trying to interact with has a name.

The button im trying to press does not have a name, the HTML is simply:

<input type='submit' value='invite'>

Is there any way I can click that button even though it doesnt have a name?

I've been racking my brains for this script, i've litterally spent 2-4 hours a DAY trying to figure this script out and i've been working on this for about a week now

Share this post


Link to post
Share on other sites

one more question regarding this, as I am still having issues, many thanks for helping me thus far.

The button i want to click doesnt have a name.

<input name='submitExample' type='submit' value='Submit'>

That is what i'm talking about, in any example script you use through autoit, whatever you're trying to interact with has a name.

The button im trying to press does not have a name, the HTML is simply:

<input type='submit' value='invite'>

Is there any way I can click that button even though it doesnt have a name?

I've been racking my brains for this script, i've litterally spent 2-4 hours a DAY trying to figure this script out and i've been working on this for about a week now

Seet the Remarks section for any of the _IE*GetObjByName functions.

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

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