If you mean how to deal with the probelm that the executable program is not in the same directory as the macro file, just write the relative path of your run.mac, e.g. if you are in a build/ path and your macro file is in the parent path, just use
I tried to execute the program using the same code but it shows error.
PreInit> /control/execute /run.mac
ERROR: Can not open a macro file <…/run.mac>. Set macro path with “/control/macroPath” if needed.
Are you sure you enter the path of your macro file correctly?
This command seems to indicate that run.mac is at the root directory! I doubt this is not the case for you.
Suppose we have a file structure like this:
|__ build
|__ example (this is your executable file)
|__ macros
|__ run.mac
you can use /control/execute ../macros/run.mac to run your macro file or you can use /control/macroPath ../macros then /control/execute run.mac to run the same macro file.