is there a stable way to get the directory / file path of the macro that is currently active?
I have a macro that is triggered via a shortcut (F10). Upon starting it reads out a txt file with scaling information that is in a subfolder of the directory of the macro. When I have the macro directory I can always define the location of the txt file relatively to it. e.g. “macro_path\subfolder”
seems to give me partially what I want. Problem is: it changes, and is not a stable permanent solution.
It returns the path of the last file/image/macro opened. Which is fine, when I install the macro and so the macro is the last thing opened. But the macro itself opens images, which redirects the meaning of File.directory() to that path (of the opened image).
The next time I trigger my macro using the shortcut it crashes, because the path name to the subfolder is now non-sensical (“image_path\subfolder”)
Is there a better way to get the macro directory path?