Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] Cannot find image - maybe related to resolution?
#1
Hi,

I wrote a macro that scrolls down a a list of data and search for an image and performs an operation. This works fine on my computer but fails on another user's computer. I wonder if this is related to screen resolution? If so, are there fixes? (besides repeating the search with every possible resolution of the image).

Thanks
#2
Can be many reasons, I listed all I know in QM Help -> Find image on screen (scan Help).

A workaround could be:
Create another macro that allows the user to capture the image and saves it in a file. Run that macro on each computer.

Macro Macro2753
Code:
Copy      Help
CaptureImageOrColor(0 0 0 "$temp$\qm captured image 58964.bmp")

Then let the main macro use the saved image.

Macro Macro2754
Code:
Copy      Help
scan("$temp$\qm captured image 58964.bmp" 0 0 3|16)

Or all in single macro.

Macro Macro2753
Code:
Copy      Help
str bmpFile="$temp$\qm captured image 58965.bmp"
if !FileExists(bmpFile)
,if(!CaptureImageOrColor(0 0 0 bmpFile)) ret

scan(bmpFile 0 0 3|16)
#3
Thanks, Gintaras!
#4
Is there a way to save the bmp into my own custom directory with the $ $ wildcard characters?

I tried something like
str bmpFile="$mydir$\like-button.bmp"

but it seems the $ $ only works for special directories?

eg I was hoping this code would allow my macro to search for "like-button.bmp" anywhere as long as the directory is named "mydir"

eg both of these would be fine.
c:\mydir
e:\asdfwerf\mydir

I hope this is clear?
#5
Macro Macro2824
Code:
Copy      Help
SetEnvVar "mydir" "e:\asdfwerf\mydir" ;;this can be in a function that is executed when QM or exe process starts. Then %mydir% can be used anywhere in strings with QM file functions.
;...
str bmpFile="%mydir%\like-button.bmp"
#6
Thanks for the code. I can't get it to work. My code is not saving a file to my hard drive. Here's my code so far.

Macro scans user's existing image or grabs new one - use when exporting my macros that scan screen
Code:
Copy      Help
SetEnvVar "aakit" "D:\0 aa\project - tools\aakit" ;;this can be in a function that is executed when QM or exe process starts. Then %mydir% can be used anywhere in strings with QM file functions.


str bmpFile="$aakit$\qm captured image 58965.bmp"
if !FileExists(bmpFile)
,if(!CaptureImageOrColor(0 0 0 bmpFile)) ret

scan(bmpFile 0 0 3|16)
#7
%aakit%
#8
Thanks! :oops:


Forum Jump:


Users browsing this thread: 1 Guest(s)