Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiling .exe with multiple image files
#1
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]
Code:
Copy      Help
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
#2
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:

Code:
Copy      Help
_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))
#3
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
Code:
Copy      Help
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
#4
:10
#5
Thankyou!

Regards
Mat
#6
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
Code:
Copy      Help
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
#7
Need resource id in scan, like in my last example code.
#8
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
Code:
Copy      Help
#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
Code:
Copy      Help
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
#9
Sorry, Gintaras I have it working now Smile

I had the code formatted incorrectly.

Thank you kindly for all your help.

Regards
Matt


Forum Jump:


Users browsing this thread: 2 Guest(s)