Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing files in current macro's directory
#1
Is there anyway to acces files in current macro's directory?

Lets say i have my qml file in "C:\Macros\SomePrg"
How do i easily access files in this directory and subdirectories of it without hardcoding this path in my macro?

Maybe this isnt posible yet but it becomes more obviously needed with the image scan function...
Well thats all for now, 3M
#2
Open or create function init2. Put this code. Run init2 or restart QM.

Code:
Copy      Help
rget _s "file" "Software\Gindi\QM2\settings"
_s.getpath(_s "")
_s-"qml="
_putenv _s

This code gets path of current QM macro list file and stores into environment variable qml. An environment variable in file functions (including scan) is expanded if it is enclosed in % and is at the beginning. For example, "%qml%\a.bmp" will be expanded to "C:\Macros\SomePrg\a.bmp"
#3
ok great thx.

You should provide an easier buildin way for this feature in next patch.
It will be used alot with the scan functionality Wink

Until you showed me the way to find the current qml file using registry, i didnt even know it was recorded like that....

For other interested what it does, who cant decript it:
It looks-up the value of registry key: HKEY_CURRENT_USER\Software\GinDi\QM2\settings\file
Then takes only the path part of it.
Then prepends qml= and parses the complete string as a argument to _putenv

If for example the current qml-file is "C:\Macros\Someprg\test.qml", then a environment variable is created as: qml=C:\Macros\Someprg
Well thats all for now, 3M


Forum Jump:


Users browsing this thread: 1 Guest(s)