Sign in to follow this  
Followers 0
GodsPain

A Few Questions

8 posts in this topic

#1 ·  Posted (edited)

Ok so im still pretty new to the scripting world but im getting most of the basics down but now im at the point where i have a few questions about what i can do.

1. Whats the best way to be able to have the script scan for a few images and if one of the images comes back it does a action? i was thinking having a image search with If but if im looking for more then 3 images what would be the best option to do?

 

2. If im inspecting a element what would be a good way to  read the elements data and also whats a good way to click on  a certain element, im using chrome but im assuming i would have to start using IE which isnt a issue i was using google but i wasnt really about to find the exact answer im looking for.

IE. Im trying to click on this "Freehold"

<span class="village-name ng-binding" ng-class="{'village-emphasis' : selectedVillageId == village.getId()}" ng-click="select(village.getId())">Freehold</span>

 

Edited by GodsPain

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

On 8/10/2016 at 1:56 PM, GodsPain said:

Whats the best way to be able to have the script scan for a few images and if one of the images comes back it does a action? i was thinking having a image search with If but if im looking for more then 3 images what would be the best option to do?

Is it within a browser, a directory or a application window?

 

On 8/10/2016 at 1:56 PM, GodsPain said:

If im inspecting a element what would be a good way to  read the elements data and also whats a good way to click on  a certain element, im using chrome but im assuming i would have to start using IE which isnt a issue i was using google but i wasnt really about to find the exact answer im looking for.

IE. Im trying to click on this "Freehold"

<span class="village-name ng-binding" ng-class="{'village-emphasis' : selectedVillageId == village.getId()}" ng-click="select(village.getId())">Freehold</span>

Try something like:

#include <IE.au3>

$oIE = _IECreate("http://your.site/")
$oCollecton  = $oIE.document.getElementsByClassName("village-name")
For $i=0 To $oCollecton.length-1
    $oItem = $oCollecton($i)
    If $oItem.innerText == "Freehold" Then _IEAction($oItem, "click")
Next

 

Edited by genius257
missing code fix

Share this post


Link to post
Share on other sites
27 minutes ago, genius257 said:

Is it within a browser, a directory or a application window?

 

Try something like:

#include <IE.au3>

$oIE = _IECreate("http://your.site/")
$oCollecton  = $oIE.document.getElementsByClassName("village-name")
For $i=0 To $oCollecton.length-1
    $oItem = $oCollecton($i)
    If $oItem.innerText == "Freehold" Then _IEAction($oItem, "click")
Next

 

1. Its withing a browser what ive managed towork out is this:

Func CheckReport()
For $i = 1 To 15
    ConsoleWrite("Failed Check" & $i & @CRLF)

   $V1 = _ImageSearchArea("Images/V1.png",1,$L,$T,$B,$R, $x, $y, 0)
If $V1 = 1 Then
   Call ("V1")
   ExitLoop
Else
   $V2 = _ImageSearchArea("Images/V2.png",1,$L,$T,$B,$R, $x, $y, 0)
If $V2 = 1 Then
   Call ("V2")
   ExitLoop
Else
   $V3 = _ImageSearchArea("Images/V3.png",1,$L,$T,$B,$R, $x, $y, 0)
If $V3 = 1 Then
   Call ("V3")
   ExitLoop
Else
   $V4 = _ImageSearchArea("Images/V4.png",1,$L,$T,$B,$R, $x, $y, 0)
If $V4 = 1 Then
   Call ("V4")
   ExitLoop
Else
   $V5 = _ImageSearchArea("Images/V5.png",1,$L,$T,$B,$R, $x, $y, 0)
If $V5 = 1 Then
   Call ("V5")
   ExitLoop
EndIf
EndIf
EndIf
EndIf
EndIf
Sleep(200)
Next
Sleep(100)
ConsoleWrite(" Failed Check Report" & @CRLF)
ConsoleWrite("Calling Click Report" & @CRLF)
Call("ClickReport")
EndFunc

But not sure if that would be the best way to go about it.

 

Also for the 2ed thing ill try it out when i get home to my main computer 

Share this post


Link to post
Share on other sites
15 minutes ago, GodsPain said:

But not sure if that would be the best way to go about it.

Hmmm... is the images tied to a specific url, and if not, is the comparison percentage based or just 100% pixelmatch?

Share this post


Link to post
Share on other sites
17 hours ago, genius257 said:

Hmmm... is the images tied to a specific url, and if not, is the comparison percentage based or just 100% pixelmatch?

<div class="title ng-binding">#4# </div>

is the element of Pic

 

would  be somthing i could use?

#include <IE.au3>

$oIE = _IECreate("http://your.site/")
$oCollecton  = $oIE.document.getElementsByClassName("title ng-binding")
For $i=0 To $oCollecton.length-1
    $oItem = $oCollecton($i)
    If $oItem.innerText == "#4#" Then _IEAction($oItem, "click")
Next

and i belive its based off comparison from a PNG file 

im not 100% sure tho

Share this post


Link to post
Share on other sites
2 minutes ago, GodsPain said:

would  be somthing i could use?

yeah i would say so :)

Share this post


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

yeah i would say so :)

Ill go ahread and test it out now since i just got home thank you

Share this post


Link to post
Share on other sites
17 minutes ago, GodsPain said:

Ill go ahread and test it out now since i just got home thank you

one more question is there a way to have it so that it looks into part of the inner text?

like just for 4 instead #4#

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