18 April 2009

How to refer to things on the same portable drive

USB drive letters

People who run Opus from a USB drive often carry other programs on the same drive and want to run them from Opus buttons.

The USB drive won't always be assigned the same letter, so how do you create buttons which refer to other programs on the USB drive when you don't know what the path will be?

The home alias

You can do it using the home alias. This built-in alias always points to where Opus is installed (where you will find dopuslib.dll and so on).

To see where the home alias points, type /home into the location field in Opus.

Let's look at how you can use the home alias in your buttons...

  1. Relative to home:

    If your USB drive has Opus installed in X:\DOPUS\ and you want to run X:\UTILS\HANDY.EXE then put this in your button:

    {alias|home}..\UTILS\HANDY.EXE

    As is standard on Windows, adding .. after a folder will take you to its parent. So in this example, {alias|home}..\ is the same as X:\ but without having the drive letter hard-coded.

  2. Via the drive letter:

    You can also use the {alias} code to get just the drive letter that Opus is running from. In this particular example the parent of the home folder is the same as the root of the drive so it doesn't make much difference. Here is the button code anyway:

    {alias|home|\}UTILS\HANDY.EXE

  3. Alternative:

    If you are [i]not[/i] creating an MS-DOS Batch type of button then Opus will automatically expand /home without you having to use the {alias} code:

    /home\..\UTILS\HANDY.EXE

    Just remember that it doesn't work with MS-DOS Batch buttons. It's probably best to get into the habit of always using one of the other methods since they work in all situations.


Not just for USB installs

All of this works when Opus is installed normally as well. If you have Opus and Windows installed to the default locations then all of the follow examples will launch the windows Calculator:

{alias|home|\}Windows\system32\calc.exe


{alias|home}..\..\..\..\Windows\system32\calc.exe


/home\..\..\..\..\Windows\system32\calc.exe

Of course, it would be much easier to run C:\Windows\system32\calc.exe directly if you know that's where it will always be.

Don't forget the quotes

If there are spaces in your paths then don't forget to put quotes around them. For example:

"{alias|home|\}Program Files\Beyond Compare 3\BComp.exe"

See also: List of FAQs by topic

PS: You can grab an almost-finished version of the new Raw Digital Camera plugin from here or wait for the next version of Opus which should contain the finished version. (Some features of the final version required changes in Opus itself.)