Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
System Files
#1
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
#2
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.
#3
This is an interesting topic since I am facing similar problems. I use the following codes to find an executable but I have not tested it if the executable is on another drive.

Code:
Copy      Help
Dir d; str vPath
foreach(d; "c:\listing.exe" FE_Dir 0x4)
     vPath=d.FileName(1); err
     if vPath =! ""
          break
out vPath


From the above code, this will only search for the C drive correct? What if there are other drives? And it happens that the program is installed on another drive other than the C?
#4
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")
#5
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")
#6
To search in other drives too, add more foreach.

Code:
Copy      Help
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


Forum Jump:


Users browsing this thread: 1 Guest(s)