-
Notifications
You must be signed in to change notification settings - Fork 1
Active Path
An active path is a path of file or directory which is selected, focused, or editing in the current active application. For example, a path of the selected file in Windows Explorer, or a path of the editing file in Visual Studio.
RunAnywhere can discover the active path from several supported applications when you press hot key to call out its command window, and deliver the path to the command executed later.
RunAnywhere can discover the active path from applications listed below:
-
Windows Explorer
-
Visual Studio 2017/2019
Note: a Visual Studio extension (included in the installer of RunAnywhere) must be installed.
-
Everything(https://www.voidtools.com/)
Note: the “Path” column in Everything must be set to visible.
-
Notepad++
Note: a Notepad++ plugin (included in the installer of RunAnywhere) must be installed.
More applications will be supported in the future.
An active path directive is a string starts with @ , along with an optional modifiers suffix.
Modifiers are used to change the content of active path. Supported modifiers are listed below (suppose that the active path now is C:\Projects\RunAnywhere\src\about_window.cpp discovered from Visual Studio):
Workspace modifier
A ~ character. Changes the active path to a workspace path. The meaning of workspace path is depending on application where the active path discovered from. For example, for Visual Studio, the workspace path is the path of solution directory. If there is no workspace path to the application, this modifier changes nothing.
Usage: @~, which result is C:\Projects\RunAnywhere.
Directory modifier
One or more . characters. If there is only single ., changes the active path to its directory path if it refers to a file, or changes nothing if it refers to a directory. Starting from the second ., changes the active path to its parent directory path.
Usage:
@., which result is C:\Projects\RunAnywhere\src.
@.., which result is C:\Projects\RunAnywhere.
@..., which result is C:\Projects.
Name modifier
A n character. Changes the active path to its file name or directory name.
Usage: @n, which result is about_window.cpp.
Modifiers combination
Multiple modifiers can be used at the same time, as long as they appear in the order listed above.
Usage:
@~..n, which result is Projects.
@~n, which result is RunAnywhere.
@.n, which result is src.
You can just input an active path directive in command window to display its content.
The active path will be automatically delivered to the executed command, which is typically a user-defined command, or a built-in command that handles file system objects. If you want to change the content delivered to a command, use active path directive as the first argument.
For example, consider that a user-defined command dir which opens a directory of the active path in Windows Explorer, and the active path now is C:\Windows\System32\drivers. If you input dir and execute, C:\Windows\System32\drivers will be opened; if you input dir @.. and execute, C:\Windows\System32 will be opened.
When you writing user-defined commands in bundle script file, you almost always need to use an active path variable to accept the delivered active path. For more detail information, see Format of Bundle File.