In order to test whether certain software is installed, I am routinely using @IfExists to test whether some crucial directory or file exists. This works most of the time, but difficulties can arise with 32/64-bit machines, and with software companies fiddling with the names of their directories or files.
Does DOpus provide a less dodgy method that directly queries the Windows list of installed programmes? That would allow a simple switch along the lines of @IfInstalled:Sandboxie
To explain: I "backup" the DOpus configuration on my computer and then "restore" it onto the other home network computers. Hence I need simple switches when launching some programmes. For example, Sandboxie is inappropriate on one of the computers. Also, one computer may be using paid software, while the others are using a free alternative.
You could query things in virtually any way you wanted using a script.
In most cases I doubt they'd be any more reliable than checking if a path exists, unless the program moves around when updated (which can be solved, but the best way will depend on the program).
Thanks again, Leo. You've confirmed that my approach of testing the existence of a directory or file is sensible (a script would be overkill). In most cases I can use the .lnk file in the Start Menu both to launch the programme and also to test for its installation --- a one-line button calls a user-defined command that contains the switch. So it's all reasonably efficient, and when things break, I fix them.
The "apppath" code could also be of some help here I maybe.
From the docs:
[quote]Returns the path of an installed application, as listed in the App Paths key in the registry.
For example, {apppath|winword.exe} would insert the install path of Microsoft Word.[/quote]
If I remember correctly, this also works for FSUtil.Resolve() on the scripting level.
This could be useful for applications for which you don't know the exact path to test for.
Thanks, tbone and Leo, for the tip and the caveat. The {apppath|. . .} code, however, seems to have some peculiarities, and I can't work out how to use it with @IfExists:
{AppPath} does not work — it's the only instance of a case-sensitive DOpus code that I've run into.
The following two things don't happen with the very similar {alias|. . .} code:
(a) The command {DlgString|AAA{apppath|winword.exe}XXX|BBB{apppath|winword.exe}YYY} places a very wide space before and after the path in both places.
(b) If I omit the AAA, then the path without XXX appears in the introductory text, and XXX without the path appears in the box.
Perhaps because of these spaces, @IfExists: reports that the following paths do not exist: @IfExists:{apppath|winword.exe} @IfExists:{apppath|winword.exe}winword.exe
On the other hand, Go {apppath|winword.exe} and Go {apppath|winword.exe}winword.exe both work, and if I substitute the explicit paths, @IfExists: correctly reports that these two paths exist: @IfExists:C:\Program Files (x86)\Microsoft Office\Office14\ @IfExists:C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE