Posts: 197
Threads: 60
Joined: Dec 2013
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
Posts: 12,097
Threads: 142
Joined: Dec 2002
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
CaptureImageOrColor(0 0 0 "$temp$\qm captured image 58964.bmp")
Then let the main macro use the saved image.
Macro
Macro2754
scan("$temp$\qm captured image 58964.bmp" 0 0 3|16)
Or all in single macro.
Macro
Macro2753
str bmpFile="$temp$\qm captured image 58965.bmp"
if !FileExists(bmpFile)
,if(!CaptureImageOrColor(0 0 0 bmpFile)) ret
scan(bmpFile 0 0 3|16)
Posts: 197
Threads: 60
Joined: Dec 2013
Posts: 197
Threads: 60
Joined: Dec 2013
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?
Posts: 12,097
Threads: 142
Joined: Dec 2002
Macro
Macro2824
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"
Posts: 197
Threads: 60
Joined: Dec 2013
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
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)
Posts: 12,097
Threads: 142
Joined: Dec 2002
Posts: 197
Threads: 60
Joined: Dec 2013