Posts: 58
Threads: 19
Joined: Mar 2013
Gintaras, I need to include multiple image files I when creating the .exe, however not all the image files are directly pathed in the macro, it loops through on the scan but only only one is matched each time (there are 37 in total).
Will QM know that I need to include multiple image files within my macro when compiling .exe by simply adding the
:10 before the partial file name? Or do I need to somehow explicitly define the path for each individual file?
Macro
Macro [b]SL[_b] [help1][_help1]
for Count 0 37
,,SetRect &r 657 249 693 296
,,if(scan(F":10 C:\Users\admin1\Documents\My QM\SL\num{Count}.bmp" w r 0 100))
,,,CurrentNumber=Count ;;assign most recent number spun to variable
Kind Regards
Matt
Posts: 12,073
Threads: 140
Joined: Dec 2002
QM does not know values of variables in F"string" when making exe, therefore cannot add the files.
You can add each file with #exe addfile "c:\....bmp" id RT_BITMAP.
But easier is this:
_s=
;:1 C:\Users\admin1\Documents\My QM\SL\num0.bmp
;...
;:38 C:\Users\admin1\Documents\My QM\SL\num37.bmp
for Count 0 37
,SetRect &r 657 249 693 296
,if(scan(F":{Count+1} C:\Users\admin1\Documents\My QM\SL\num{Count}.bmp" w r 0 100))
Posts: 58
Threads: 19
Joined: Mar 2013
Thank you Gintaras, I am also trying to add a bmp file required for a wait command, but when I try and run the program it is giving me an error.
Function
Hot
wait 420 S "10: C:\Users\admin1\Documents\My QM\images\lb.bmp" w 0 1|0x400 50
and the error:
Error (RT) in Hot: cannot open file.
The file exists, I modified the "10: after S and before the path.
Also can I use %username% to specify the user's default directory for file saving?
Kind Regards
Matt
Posts: 12,073
Threads: 140
Joined: Dec 2002
Posts: 58
Threads: 19
Joined: Mar 2013
Posts: 58
Threads: 19
Joined: Mar 2013
Hi Gintaras,
This is still not quite working as I expected. I created the .exe and added the image files as resources. Output confirmed they were added and the .exe created.
-- Files --
%userprofile%\images\lb.bmp
%USERPROFILE%\images\num0.bmp
..
%USERPROFILE%\images\num36.bmp
Created TRP.exe, 458 KB. Run Find
However when I run the .exe on another PC (from the one where the macros was created) it closes with an error. I think the issue is related to the following code
Function
Hot
for Count 0 37 ;;cycle through each saved image file
,,SetRect &r 551 59 605 94 ;;set the rectangle on the screen, relative to the active game window
,,if(scan(F"%USERPROFILE%\images\num{Count}.bmp" w r 0 100 )) ;;if a match is found between marquee number and .bmp continue
It scans all 37 images until a match is found, but it is looking for the images folder in the user profile directory, which will obviously not exist on other PCs. How can I change this so that is can scan the image files that were added as resources? Is it possible? Or do I need to create a setup program and include the image files separately?
Thanks kindly
Matt
Posts: 12,073
Threads: 140
Joined: Dec 2002
Need resource id in scan, like in my last example code.
Posts: 58
Threads: 19
Joined: Mar 2013
Gintaras Wrote:Need resource id in scan, like in my last example code.
Hmm, not sure what I am doing wrong, I ensured the resource ID is in the scan but I still can't get it to work when compiled as an executable. I now receive the error
Error (RT) in Hot: resource not found.
So I have added the resource files as follows for images 1 through 37 (using resource IDs 1 - 37)
Function
Hot
#exe addfile "%USERPROFILE%\images\num36.bmp" 37
I compile as exe and the output confirms they were added.
I ensured the resource ID is in the scan
Function
Hot
if(scan(F":{Count+1} %USERPROFILE%\images\num{Count}.bmp" w r 0 100 ))
But when I run it, it closes and shows the error about the resource not being found.
Sorry, if I am overlooking something really simple :oops:
Kind Regards
Matthew
Posts: 58
Threads: 19
Joined: Mar 2013
Sorry, Gintaras I have it working now
I had the code formatted incorrectly.
Thank you kindly for all your help.
Regards
Matt