Images in .exe

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
promacronoob
Newbie
Posts: 4
Joined: Thu Jul 06, 2017 12:19 pm

Images in .exe

Post by promacronoob » Thu Jul 20, 2017 5:46 pm

I am saving all my images in one folder because I need the same image across numerous scripts. When I compile the scripts to use on another machine the images are not packaged (at all) how the images which are saved to the script specific folder (%BMP_DIR%).

Is Macro Scheduler capable of packaging images used in the script, but not connected through %BMP_DIR%? If not, is there another way to navigate this problem without doing so manually?

Thanks!

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Images in .exe

Post by Marcus Tettmar » Mon Jul 24, 2017 9:49 am

You don't have to use BMP_DIR. That is just how the wizard packages them. BMP_DIR is a folder with the same name as the script. When you compile the macro it will copy this folder to the exe location, renaming it to match the .exe

But if you want you could replace BMP_DIR with a physical path or a variable pointing to any path you like. Or use SCRIPT_DIR.

Anything. Do precisely as you wish.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

promacronoob
Newbie
Posts: 4
Joined: Thu Jul 06, 2017 12:19 pm

Re: Images in .exe

Post by promacronoob » Mon Jul 24, 2017 3:17 pm

I understand I do not need to use BMP_DIR to reference an image. What I would like to do is save all the images in a single folder (so different name as scripts because there will be numerous scripts using these images). When I use a physical path, the compiler does not package the images into a folder with the same name as the exe.

This seems like a limitation of Macro Scheduler, but I am posting this to see if there is an easier workaround than having a unique folder for each script.

Hope this clarifies things.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Images in .exe

Post by Marcus Tettmar » Mon Jul 24, 2017 3:23 pm

How could it? If a physical path is included in the script then if it were to move those images it would also have to change that path in the script, modifying the script. If you want to have the scripts packaged that's what BMP_DIR is designed for. A physical path means the developer wants that path - they've specifically hard-coded it - so IMO it would be wrong for that to be modified and things moved.

It's not a "limitation" because we've provided a number of ways for relative paths and packaging. You can either hard code a physical path, or use variables (which could be e.g. read from an INI file or other settings file) or use BMP_DIR for automatic packaging. So in providing infinite possibilities I fail to see how it would be a limitation. Sorry.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Images in .exe

Post by Marcus Tettmar » Mon Jul 24, 2017 3:44 pm

Maybe an example will help.

This is what I would do:

1. Make an INI file. You can use Notepad for this. Call it mysettings.ini. Make it look like this:

[settings]
IMAGE_DIR=c:\bla\whatever\images\

2. At the top of your script do this:

ReadInifIle>%SCRIPT_DIR%\mysettings.ini,settings,IMAGE_DIR,BMP_DIR

3. Store mysettings.ini in the same folder as your script/exe.

4. Use BMP_DIR in place of physical path in your FindImagePos/WaitScreenImage lines etc. Don't have to use BMP_DIR - create any variable you like.

5. Put the images wherever you like, modify the INI file accordingly. So now you can move things around, to different PCs, wherever and you just need to modify the INI file to suit the setup.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts