Jump to content

Recommended Posts

Posted (edited)

I don't really have any code cuz whatever i try it doesnt work -.- 

Can anyone please make me a sample i can study? <,< i need to make a simple script to open explorer click some objects on the site , rinse repeat.. a example with autoit' website is just fine i just need to study it.. the i can't seem to find any yt video on this.. '-_-

And yes i tried looking at the manual .. but i dont get anything from it <.<'

 

Any help highly appreciatet <3 

Edited by Dequality

Share this post


Link to post
Share on other sites
ERROR CODE

--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: Activity, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
#include <IE.au3>

$oIE = _IECreate("https://www.autoitscript.com/forum/", 0, 1, 1, 0)
Sleep(5000)
$Activity = _IEGetObjByName($oIE, "Activity")

_IEAction($Activity, "click")

 

Share this post


Link to post
Share on other sites
26 minutes ago, Dequality said:

Can anyone please make me a sample i can study?

There are quite a tons on the forums and on the Help file, where you should start looking at from.

The console is telling you exactly what your script is doing, so, you don't need any help from anyone.

Just understand what you have done.


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Just now, FrancescoDiMuro said:

There are quite a tons on the forums and on the Help file, where you should start looking at from.

The console is telling you exactly what your script is doing, so, you don't need any help from anyone.

Just understand what you have done.

Well.. ty i guess? :blink:

Share this post


Link to post
Share on other sites

Assuming that your snippet of code was trying to click the "Activity" tab below:

image.png.1352956374d028bab3d2d343319a1899.png

If you look at the actual HTLM source for that link, it looks like:

<a href="https://www.autoitscript.com/forum/discover/unread/" data-navitem-id="2">Activity</a>

As you can see, that tag does not have a "name" attribute equal to "Activity" (name="Activity").  As a matter of fact, no tag on that page has an attribute with name="Activity".  That is why you got the NoMatch error.

What it appears you were trying to do was to click the link whose text was "Activity".  If so, then you want something similar to:

#include <IE.au3>

Local $oIE = _IECreate("https://www.autoitscript.com/forum")

_IELinkClickByText($oIE, "Activity")

If you were not trying to click that link, maybe a better explanation of what you were trying to do would help.

As FrancescoDiMuro said, the help file and forum are full of examples.  Spending some time looking thru the _IE* functions and their examples in the Help file, as well as the IE_Example example and trying to understand what is going on in those examples, should give you a solid foundation upon which to build upon.  If you actually spent time looking thru them, as you said, and got nothing from it, I doubt that you would get anything more from any additional examples that anyone else could provide.

Share this post


Link to post
Share on other sites

Well, it may sound obvious for those who spent hundreds of hours scripting a specific UDF.  But I understand the one who is starting and facing with  this incredible amount of information.  Been there too.  So thanks for @TheXman to give a clear explanation of the mechanics behind it.

 

Share this post


Link to post
Share on other sites
Posted (edited)
6 hours ago, TheXman said:

Assuming that your snippet of code was trying to click the "Activity" tab below:

image.png.1352956374d028bab3d2d343319a1899.png

If you look at the actual HTLM source for that link, it looks like:

<a href="https://www.autoitscript.com/forum/discover/unread/" data-navitem-id="2">Activity</a>

As you can see, that tag does not have a "name" attribute equal to "Activity" (name="Activity").  As a matter of fact, no tag on that page has an attribute with name="Activity".  That is why you got the NoMatch error.

What it appears you were trying to do was to click the link whose text was "Activity".  If so, then you want something similar to:

#include <IE.au3>

Local $oIE = _IECreate("https://www.autoitscript.com/forum")

_IELinkClickByText($oIE, "Activity")

If you were not trying to click that link, maybe a better explanation of what you were trying to do would help.

As FrancescoDiMuro said, the help file and forum are full of examples.  Spending some time looking thru the _IE* functions and their examples in the Help file, as well as the IE_Example example and trying to understand what is going on in those examples, should give you a solid foundation upon which to build upon.  If you actually spent time looking thru them, as you said, and got nothing from it, I doubt that you would get anything more from any additional examples that anyone else could provide.

I wan't to be able to find a button by _IEObjGetById/Name seems like its more reliable? :think: but ty a lot for the explanation! will try it out right now :)!

 

#include <IE.au3>

$oIE = _IECreate("https://www.autoitscript.com/forum/", 0, 1, 1, 0)
Sleep(5000)
_IELinkClickByText($oIE, "Activity")

I tried this now, no error but still didnt click anything? :think: 

Edited by Dequality

Share this post


Link to post
Share on other sites
1 hour ago, Dequality said:

I tried this now, no error but still didnt click anything?

To say that, you should check for an error, and you do it with

If @error Then
    ConsoleWrite("Error calling FunctionName. Error: " & @error & @CRLF)
Else
    ; Do something
EndIf

 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, FrancescoDiMuro said:

To say that, you should check for an error, and you do it with

If @error Then
    ConsoleWrite("Error calling FunctionName. Error: " & @error & @CRLF)
Else
    ; Do something
EndIf

 

Think i fixed it, it's working properly now but i have to hit a button which is written in java is that possible? :think: 

<a href="javascript:void(0);" onclick="return('0', '427', 'autotrainer', '', '', '', '525251', '', '', '', '30', '');"><strong>btn</strong> <br><small><i>30 </i></small></a>

this is the text i get when i right click > inspect the element :think: 

Edited by Dequality

Share this post


Link to post
Share on other sites
11 hours ago, Dequality said:

I tried this now, no error but still didnt click anything?

Was trying to see if I had the same problem as you.  And Yes I had. So after few hours of testing I finally found that there is 2 "Activity" links and it's the second link that works.

Share this post


Link to post
Share on other sites
On 04/01/2019 at 5:25 PM, Nine said:

Was trying to see if I had the same problem as you.  And Yes I had. So after few hours of testing I finally found that there is 2 "Activity" links and it's the second link that works.

How did you find the second one? 

Share this post


Link to post
Share on other sites
5 hours ago, Dequality said:

How did you find the second one? 

$collection = _IELinkGetCollection ($oIE)

$c = 0
for $obj in $collection
  If not $obj.id Then ContinueLoop
  $c += 1
  $arr[$c][0] = $obj.name
  $arr[$c][1] = $obj.id
  $arr[$c][2] = $obj.innerText
  $arr[$c][3] = $obj.outerText
Next

_ArrayDisplay ($arr)

 

Share this post


Link to post
Share on other sites
Posted (edited)

@Nine
Shouldn't you set $c+=1 before the Next command?

Spoiler
#include <Array.au3>

Global $intRow = 0, _
       $arrSomeArray[10][1]

For $i = 0 To 9 Step 1
    $arrSomeArray[$intRow][0] = $intRow
    $intRow += 1
Next

_ArrayDisplay($arrSomeArray)

 

In this way, you have one row that is not filled :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
5 minutes ago, FrancescoDiMuro said:

@Nine
Shouldn't you set $c+=1 before the Next command?

  Reveal hidden contents
#include <Array.au3>

Global $intRow = 0, _
       $arrSomeArray[10][1]

For $i = 0 To 9 Step 1
    $arrSomeArray[$intRow][0] = $intRow
    $intRow += 1
Next

_ArrayDisplay($arrSomeArray)

 

In this way, you have one row that is not filled :)

yes i know but it is only a debugging tool, I thought you would have known that :huh2:

Share this post


Link to post
Share on other sites

@Nine
Yeah, sure 
:)
 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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

  • Similar Content

    • By yffulf
      Is there probably a way to click ie popup button and hide or invisible popup button in the same time?
      I try to use WinSetState @SW_hide ,
      the result is ie crashing or no response because button hide and the next click command won't work...
      $oForm=_IEFormGetObjByName($oIE,"form1") $obutton=_IEFormElementGetObjByName($oForm,"btn_OK") $hWnd = _IEPropertyGet($oIE, "hwnd") _IEAction($obutton,"focus") ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") WinWait("", "確定存檔嗎?") WinSetState("","確定存檔嗎?",@SW_Hide) ControlClick("", "確定存檔嗎?", "[CLASS:Button; TEXT:確定; Instance:1;]")  
    • By _leo_
      Hey there!
      I am having a problem with clicking a button in IE. As you can see in the code, there would be a class name to click it, but since this button exists several times with exactly the same code, I can only use the "Noch nicht veröffentlicht" to separate it from the others. But this part is just pure text without any classification. 
      "<div class="checkmark" data-v-1e5b1f70=""><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 16 16" data-v-1e5b1f70=""><circle cx="8" cy="8" r="8" data-v-1e5b1f70="" /></svg></div>Noch nicht veröffentlicht"
      I was trying to click it with:
      #include <IE.au3> local $oNNVs = _IEFormGetCollection($oIE2) For $oNNV in $oNNVs If String($oNNV.innertext) = "Noch nicht veröffentlicht" Then _IEAction($oNNV, "click") EndIf Next and:
      $inputs = $oIE2.document.getElementsByTagName("div") For $input In $inputs If $input.innertext == "Noch nicht veröffentlicht" then $input.click() EndIf Next But nothing seems to work. Thanks for the help!
    • By TXTechie
      Hello Everyone,
      I'm looking for a way to use an already open Internet Explorer (IE) window (if one is up and running) and then navigate to a new URL in a new IE tab.
      I thought that _IECreate would easily meet my needs. However, when I use the following script:
      #include <IE.au3> Local $oIE = _IECreate("https://" & $Server & ":8444/", 1, 1, 0, 1) ...with one or more open IE windows, it still opens yet a new IE window.
      Are there any other ideas for how to reliably use an already open IE windows and then how to open a new tab in IE to navigate to a new URL?
      Regards,
      TX Techie
    • By WoodGrain
      Hi All,
      I've tried to create a script to browse to a web page in IE, but it only works for some sites, I've tried to simplify the script as much as possible, hoping you can point me in the right direction - thanks.
      This one going to Google does work:
      #include <IE.au3> $oIE = _IECreate("https://www.google.com.au/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) But this one going to OneDrive opens the IE page, but fails immediately returning the errors, and the IE window is not closed:
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
      --> IE.au3 T3.0-2 Error from function _IEQuit, $_IESTATUS_InvalidObjectType
      #include <IE.au3> $oIE = _IECreate("https://abccorp-my.sharepoint.com/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) Even if I put a sleep timer in for 10 seconds after the _IECreate it still doesn't work
      Thanks all!
    • By Dent
      https://rmplusportal.rightmove.co.uk/
      On that page is a login form requiring username, password and then the clicking of the button (or pressing enter but I'm not a fan of using Send)
      Here's the section of code from the page that specifically deals with the form...
      <form> <div class="error-message-login" data-test="error-message"></div> <label> <span>User email</span> <div class="ui input"> <input id="email" type="text" placeholder="Your email"> </div> </label> <label> <span>Password</span> <div class="ui input"> <input id="password" type="password" placeholder="Password"> </div> </label> <button class="ui primary button" role="button" data-test="login">Login</button> <p> <a class="forgot-your-password" href="https://www.rightmove.co.uk/forgottenPasswordForm.html">Forgot your password?</a> </p> </form> Specifically the <button class...></button> is causing me problems as I can't find a way to click it. The 'User email' and 'Password' objects have an 'id' so I can reference these in the AutoIT code and interact with them and the button also previously had the id of 'login' but I guess in a change to this page that was altered.
      Oddly, if I get the code to show the instance of IE that is created and manually click Login or press Enter the page gives me an error saying 'Please enter your email address' even though it is there. I have to manually go into each field and make a change i.e. adding a character to the end of each field then deleting it before it will let me in by either clicking Login or pressing enter. So maybe there's so code elsewhere on the page that knows the fields haven't been physically typed in?
      Any help on this would be much appreciated.
×
×
  • Create New...