Prateek Posted December 29, 2018 Share Posted December 29, 2018 Hi, I am New to AutoIT, trying to accomplish a simple task where an image is required to be searched on a web page. My Code - $rectHWND = WinGetHandle("[ACTIVE]") $rectPos = WinGetPos($rectHWND) ; $found = _ImageSearchArea("example.bmp", 1, $rectPos[0], $rectPos[1], $rectPos[2], $rectPos[3], $x, $y, 100) msgbox(0,'','the line ' & ' is ' & $found) If $found = 1 Then MouseMove($x,$y, 10) EndIf Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2018 Share Posted December 29, 2018 Looks like you are missing the DllCall in the line. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 Hi, I have kept ImageSearch.au3 in "C:\Program Files (x86)\AutoIt3\Include" And have kept ImageSearchDLL.dll in "C:\Windows\System32" Also my code and example.bmp are in same folder. My script is just $rectHWND = WinGetHandle("[ACTIVE]")$rectPos = WinGetPos($rectHWND) ;$found = _ImageSearchArea("example.bmp", 1, $rectPos[0], $rectPos[1], $rectPos[2], $rectPos[3], $x, $y, 100) If $found = 1 Then MouseMove($x,$y, 10)EndIf Now where shall i put DllCall Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2018 Share Posted December 29, 2018 17 minutes ago, Prateek said: Now where shall i put DllCall On the line in the function _ImageSearchArea where you previously showed the error. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 Thanks, somehow it got deleted by only ..... I added it back there - If IsString($findImage) Then $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) Else $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP) EndIf Now i am not getting any output - I just changed my code a bit - Kindly look into it - Func checkForImage() Local $search = _ImageSearch('example.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc Regards, Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2018 Share Posted December 29, 2018 No idea. There may be a better way to accomplish your goal. What website are you trying to automate? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 This is just an internal web portal where reports are generated and are stored. Now there is this one excel icon coming on the top right of that website. There is no name or text , just an icon , looks like excel icon...I am attaching it as well. Now since there is no name, nothing, just this image and on clicking it report gets downloaded onto the system, so i am trying to automate this task...all other steps have been accomplished but i am not able to click this image.... My complete Code #include <ImageSearch.au3> WinActivate("Web Portal - IE Explorer - Citrix Platform") WinWaitActive("Web Portal - IE Explorer - Citrix Platform") HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('example.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc example.bmp Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2018 Share Posted December 29, 2018 Should be able to automate that without resorting to image search. Can you show us the HTML related to this image? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 It is inside Citrix platform, i am not able to fetch its html copy, i am restricted user..... Link to comment Share on other sites More sharing options...
Danp2 Posted December 29, 2018 Share Posted December 29, 2018 Have you checked with the browser's Developer Tools? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 Yes, the portal is on another server.... i m just firing an API....to run my results Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 29, 2018 Moderators Share Posted December 29, 2018 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Prateek Posted December 29, 2018 Author Share Posted December 29, 2018 Hi Melba, Can you please help me here? Why is this not working? #include <ImageSearch.au3> WinActivate("Web Portal - IE Explorer - Citrix Platform") WinWaitActive("Web Portal - IE Explorer - Citrix Platform") HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('example.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc Link to comment Share on other sites More sharing options...
Trong Posted December 30, 2018 Share Posted December 30, 2018 1. Download ImageSearch LIB from here: 2. Use this code #include "_ImageSearch.au3" #include "_ImageSearch_Debug.au3" HotKeySet("{Esc}", "_Exit") Func _Exit() Exit 0 EndFunc ;==>_Exit Global $_Image_1 = @ScriptDir & "\example.bmp" ;first, use this function to create a file bmp, maybe a desktop icon for example') _ImageSearch_Create_BMP($_Image_1) While 1 Local $rectHWND = WinGetHandle("[ACTIVE]") Local $rectPos = WinGetPos($rectHWND) If @error Then ContinueLoop Local $found = _ImageSearch_Area($_Image_1, $rectPos[0], $rectPos[1], $rectPos[2], $rectPos[3], 100, 1) If $found[0] = 1 Then MsgBox(0, 'Success', 'Image found:' & " X=" & $found[1] & " Y=" & $found[2] & @CRLF & $_Image_1) Else ConsoleWrite('Image not found. Searching..' & @CRLF) EndIf Sleep(200) WEnd Goodlucky Regards, Link to comment Share on other sites More sharing options...
Prateek Posted January 1, 2019 Author Share Posted January 1, 2019 Hi, I am going to try above approach today. Thanks. Link to comment Share on other sites More sharing options...
Prateek Posted January 1, 2019 Author Share Posted January 1, 2019 OMG!! Thanks a lot!. The Script is running and generating co ordinates. Thanks to you too much. Link to comment Share on other sites More sharing options...
Prateek Posted January 2, 2019 Author Share Posted January 2, 2019 Hi VIP, I am stuck at a place where i get following error while converting above file to .exe. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 2, 2019 Developers Share Posted January 2, 2019 Well... it actually tells you the error. Jos Trong 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Prateek Posted January 2, 2019 Author Share Posted January 2, 2019 Yes, moved files to autoit default folders....corrected. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now