Jump to content

Recommended Posts

Posted (edited)

Hello, I'm trying to use the  _IEGetObjByName, but in a code the website, the function not working when find a word on the line below (I was using Firebug to view this line):

<area alt="GRAFICS (NAME):40" href="javascript:__doPostBack('dbbTopGraphic$_ctl0$ccTopGraphic','GRAFICS (NAME)')" coords="372,72,402,72,402,160,372,160" shape="poly">
My code that I'm trying to use is this:
 
#include <IE.au3>

Call ("LoginSite")
Sleep (5000)
Call ("ClickGrafic")

Func LoginSite ()

Global $oIE = _IECreate ("www.sitetest.com")

Local $username = _IEGetObjByName ($oIE,"txtUSer")
Local $password = _IEGetObjByName ($oIE,"txtPassword")
Local $button = _IEGetObjByName ($oIE,"btnSingIn")

_IEFormElementSetValue ($username, "my_login")
_IEFormElementSetValue ($password, "my_password")

_IEAction ($button, "click")

EndFunc

func ClickGrafic ()

Local $poly = _IEGetObjByName ($oIE,"poly")

Local $poly = _IEGetObjByName ($oIE,"poly")

_IEGetObjByName

_IELinkClickByText($oIE, "poly")

_IEAction ($button, "click")

EndFunc

Thanks & Regards

Edited by stenioc1
Posted

To start with, please use the code tags to make it easier for everyone to read your code, regarding the issue you are facing, you have "_IEGetObjByName" after $poly without any parameters.

Posted

@stenioc1

Welcome to the AutoIt Forum.

Can you edit your Opening Post, and do what @Palestinian say ? (Look in my singature "How to post code on the forum")

 

btw.

"poly" is shape not name.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Did you try to use _IETagNameGetCollection() ?

something like this ?

Local $oAlts= _IETagNameGetCollection($oIE, "alt")
For $oAlt In $oAlts
    if StringInStr($oAlt.outerhtml,'GRAFICS (NAME)') <> 0 Then
        _IEAction ($oAlt, "click")
        ExitLoop
    EndIf
EndIf

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Of course you're right.
Which means that the time for me to sleep.
I'll see you when I wake up.

Cheers.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Thanks mLipok (thanks this usage information in the site), Danp2 and Palestinian this tips, but my code still does not work (I'm newbie in the AutoIT), but I do not understand the error:

#include <IE.au3>

Call ("LoginSite")
Sleep (5000)
Call ("ClickGrafic")

Func LoginSite ()

Global $oIE = _IECreate ("www.sitetest.com")

    Local $oUsername = _IEGetObjByName ($oIE,"txtUSer")
    Local $oPassword = _IEGetObjByName ($oIE,"txtPassword")
    Local $oButton = _IEGetObjByName ($oIE,"btnSingIn")

    _IEFormElementSetValue ($oUsername, "my_login")
    _IEFormElementSetValue ($oPassword, "my_password")

_IEAction ($oButton, "click")

EndFunc

Func ClickGrafic ()

Local $oAreas= _IETagNameGetCollection($oIE, "area")
For $oArea In $oAreas
    If StringInStr($oArea.outerhtml,'GRAFICS (NAME)') <> 0 Then
        _IEAction ($oArea, "click")
        ExitLoop
    EndIf
Next
EndFunc

The _IEAction ($oArea, "click") not working, what can be?

Sorry by the poor english.

Thanks & Regards

Edited by stenioc1
Posted

Not related with your question.

But:

Local $oButton = _IEGetObjByName ($oIE,"btnSingIn")

do you mean:

Local $oButton = _IEGetObjByName ($oIE,"btnSignIn")

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

The first part is working (Func LoginSite), my problem is that the mouse don't click in the grafic, could use the MouseMove function or another for example?

Edited by stenioc1
Posted

first use Tidy

second you are using/calling fuctions in a weired way

third, try this:

#include <MsgBoxConstants.au3>
#include <IE.au3>

LoginSite()
Sleep(5000)
ClickGrafic()

Func LoginSite()
    Global $oIE = _IECreate("www.sitetest.com")

    Local $oUsername = _IEGetObjByName($oIE, "txtUSer")
    Local $oPassword = _IEGetObjByName($oIE, "txtPassword")
    Local $oButton = _IEGetObjByName($oIE, "btnSignIn")

    _IEFormElementSetValue($oUsername, "my_login")
    _IEFormElementSetValue($oPassword, "my_password")

    _IEAction($oButton, "click")
EndFunc   ;==>LoginSite

Func ClickGrafic()
    Local $oAreas = _IETagNameGetCollection($oIE, "area")
    For $oArea In $oAreas
        If StringInStr($oArea.outerhtml, 'GRAFICS (NAME)') <> 0 Then
            ConsoleWrite("!TEST: area found" & @CRLF)
            _IEAction($oArea, "click")
            ExitLoop
        EndIf
    Next
EndFunc   ;==>ClickGrafic

and say: is this:

ConsoleWrite("!TEST: area found" & @CRLF)

taking any effect in SciTE Console ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Don't appear error in the Scite output window, but the code not working, below the results:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\cordeirs\Desktop\Projetos\AutoIT\new2.au3" /UserParams    
+>22:31:07 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3
+>22:31:07 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\cordeirs\Desktop\Projetos\AutoIT\new2.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
+>22:31:16 AutoIt3.exe ended.rc:0
+>22:31:16 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 8.880

Thanks & Regards

Posted

@stenioc1

did you try this:

$oIE_Graphic = _IEGetObjByName($oIE, 'MapdbbTopGraphic:_ct10:ccTopGraphic')
_IEAction($oIE_Graphic,'click')

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 3/17/2014 at 6:41 AM, mLipok said:

 

@stenioc1

did you try this:

$oIE_Graphic = _IEGetObjByName($oIE, 'MapdbbTopGraphic:_ct10:ccTopGraphic')
_IEAction($oIE_Graphic,'click')

 

That one should do it, if it doesn't try setting focus to $oIE_Graphic 1st then use _IEAction click

Posted
  On 3/17/2014 at 2:16 AM, stenioc1 said:

I put the string ('GRAFICS (NAME)' as an example, but the execution of the script is correct.

 

"the execution of the script is correct" ?

Correct became at the moment when it start to works exactly how you want.

Now it is not correct.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Sorry, wanted facilitate the reading of the code  :( , below my code:

#include <MsgBoxConstants.au3>
#include <IE.au3>

LoginSite()
Sleep(5000)
ClickGrafic()

Func LoginSite()
Global $oIE = _IECreate("https://moebius.sondaprocwork.com.br/Moebius/login.aspx")

Local $oUsername = _IEGetObjByName($oIE, "txtUsuario")
Local $oPassword = _IEGetObjByName($oIE, "txtSenha")
Local $OButton = _IEGetObjByName($oIE, "btnEntrar")

_IEFormElementSetValue($oUsername, "my_login")
_IEFormElementSetValue($oPassword, "my_pass")

_IEAction($OButton, "click")
EndFunc   ;==>LoginSite

Func ClickGrafic()

Local $oClickGrafic = _IEGetObjByName($oIE, "MapdbbTopGraphic:_ct10:ccTopGraphic")

_IEAction($oClickGrafic, "click")

EndFunc   ;==>ClickGrafic

 

 

And logs:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\cordeirs\Desktop\Projetos\AutoIT\new2.au3" /UserParams    
+>00:57:14 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000416  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running AU3Check (3.3.10.2)  from:C:\Program Files (x86)\AutoIt3
+>00:57:14 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\cordeirs\Desktop\Projetos\AutoIT\new2.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-1 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: MapdbbTopGraphic:_ct10:ccTopGraphic, Index: 0)
--> IE.au3 T3.0-1 Error from function _IEAction(click), $_IEStatus_InvalidDataType
+>00:57:20 AutoIt3.exe ended.rc:0
+>00:57:20 AutoIt3Wrapper Finished..
>Exit code: 0    Time: 6.409

Thanks

Edited by stenioc1
Posted

ok

now try this:

Local $oMaps= _IETagNameGetCollection($oIE, "map")
For $oMap In $oMaps
    if StringInStr($oMap.outerhtml,'MapdbbTopGraphic:_ct10:ccTopGraphic') <> 0 Then
        _IEAction ($oMap, "click")
        ExitLoop
    EndIf
EndIf

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...