Jump to content

ImageSearch using Resources


Recommended Posts

Hello there,

I'm just curious is it possible to use ImageSearch using an image that is stored with Resources? I'm having trouble getting it to work, I've been throwing examples together for testing different things but can't seem to get it to work as intended. I made and loaded an image of an icon on my desktop, ran the test and it doesn't find it, returning 0. I'll post my bad test script below. 

Thanks for any advice,

D.

 

Edit: Thought I should give a little back story, my eldest is in high school and he's doing VGCSE ICT course on technology advancement. He's been using C# in a school project that obtained Rectangular coordinates for stars and such. He/we are now trying to show how much technology has moved on from the 1980s to now, using different visual methods per "step". Since I have only knowledge in VB6 and very minor AutoIT skills I suggested I helped him show automation using AutoIT. So far he's shown image capture/recording, streaming, compression,  256-bit AES Encrpytion and a list of other stuff where as Automation will fit in the 2008 (he dated it, not me). It doesn't need to be elaborate, just a sole compiled exe that will read the entire screen, find the image and message box is it is found or not. Very simple and really all there is to it. 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_File_Add=Test.bmp, RT_BITMAP, BMP_TEST, 0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <ImageSearch.au3>
#include <ResourcesEx.au3>

Global $y = 0
Global $x = 0

Example()

Func Example()
    Local $hHBITMAP = _Resource_GetAsBitmap('BMP_TEST', $RT_BITMAP)
    $result = _ImageSearch($hHBITMAP, 1, $x, $y, 5)
    MsgBox("","Test",$result)
EndFunc

 

Test.bmp

Edited by TehDoug
Added Test.bmp of icon
Link to comment
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
 Share

  • Recently Browsing   0 members

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