I am trying to make macros that will work with most of our users. Problem is, it requires to know where windows is installed.
Is there a way for qm to determine which drive/directory xp is installed?
Thanks
Posts: 12,098
Threads: 142
Joined: Dec 2002
Instead of Windows folder path, use $windows$. Where this does not work, use str function expandpath.
str s
s.expandpath("$windows$"\Media)
out s ;;probably will be "C:\Windows\Media"
In dialogs, use SF button for $windows$ and other special folders.
Posts: 12,098
Threads: 142
Joined: Dec 2002
Many programs register itself in the registry, so that it runs when you type only exename in the Run dialog. In QM, use str function searchpath to find the program and populate the variable with the full path.
str s
s.searchpath("exename.exe")
if(s.len) out s
else out "not found"
If this does not work, must be specified path:
s.searchpath("c:\exename.exe")
if(!s.len)
,s.searchpath("d:\exename.exe")
I just tried the below example and it didn't work. Where I know the program is installed in the C drive, C:\Program Files\Listing\Listings.exe is the full path.
s.searchpath("c:\exename.exe")
if(!s.len)
,s.searchpath("d:\exename.exe")
Posts: 12,098
Threads: 142
Joined: Dec 2002
To search in other drives too, add more foreach.
Dir d; str vPath
foreach(d "c:\listing.exe" FE_Dir 0x4)
,vPath=d.FileName(1)
,goto found
foreach(d "d:\listing.exe" FE_Dir 0x4)
,vPath=d.FileName(1)
,goto found
;found
out vPath