Click here to Skip to main content
15,887,812 members
Articles / Programming Languages / Shell
Tip/Trick

Autos - Immediate Access to Resources Without Clicking

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
1 Jan 2015CPOL6 min read 15K   125   1   5
Immediate access to resources without clicking

Introduction

Autos is a collection of scripts to increase the productivity of keyboard-savvy power users and programmers. Autos exploits the ability to run VB scripts through the Run window, allowing concise commands to replace a lot of navigation and clutter.

Installation

Note: Without administrative privileges, the installer will fail to modify the path environment variable. This change can be committed manually with an administrator account. To do so, run 'AddPath.vbs' in the directory 'install' with the argument '%userprofile%\Autos\_links'. Ensure to use double quotation marks for specifying the argument.

Follow these instructions for installation:

  1. Copy the folder 'Autos' to '\Users\<username>'
  2. Run 'install.bat'
  3. Upon completion, enter 'yes' to logoff

Composition

After installation, Autos contains 3 facilities which should be concerned with, these are the content store (folder: 'content'), the script store (folder: 'scripts') and the link store (folder: '_links').

The content store contains resources for use by scripts, these resources typically provide additional information for arguments given by a user so that a script can complete its operation. Typically, all files in the content store are named after a script which uses them.

The script store mainly contains scripts, ultimately to be run by utilizing the Run window. Accidentally, the store also contains an executable named 'Clip', which is used to copy text to the clipboard.

The link store is a folder where its path has been registered with the path environment variable so that it is known by the Windows shell. Thankfully, this means that every executable or shortcut inside the folder can easily be run by utilizing the Run window. While most typical, a shortcut inside the link store doesn't necessarily have to point to an object inside the script store.

Using the Code

After installation and re-logon, all of Autos' scripts are readily available. For example, the Run command 'go so' will cause the URL {http://stackoverflow.com/} to be opened. 'go' is a script name while excluding the extension '.vbsc' which is optional. 'so' is an argument, more in-depth; 'so' is a concise abbreviation for 'Stack Overflow'.

For scripts which accept multiple arguments, any argument that contains a space must be enclosed with double quotation marks as required by the Run window.

Note that the Run window never has to be accessed by mouse clicks, use the key combination {Win+R} instead. Starting from Windows 7, the 'Run' option is neither available in the start menu by default.

An Example using Gof

Gof can yield a range of objects given any wildcard. For this example, I will use the wildcard 'max' to open a particular text file on my flash drive 'F'.

  1. Press Win+R
  2. The run window appeared. Send 'gof max'.

  3. Gof returns results. Select '1'.

  4. The file '\tech\doc\maxvalue.txt' is now open.

Scripts

Go

Go (go.vbsc) opens resources in a linear fashion. Given an argument, the location of the resource will be determined by a corresponding command element in 'go.xml' in the content store. Go always ends silently, even if the argument proves to be invalid.

Gof

Gof (gof.vbsc) searches for objects starting at a predefined directory given a wildcard, and optionally modifiers or file attributes. Gof can be extremely useful because it doesn't rely on predefined information like Go. However, Gof is less optimal as a consequence. In practice, this shouldn't be a concern unless the search space is extremely large or if the relevant hardware is underperforming.

The syntax for Gof commands is:

gof [<modifiers>:]<wildcard> [attributes]

Gof can react in three ways:

If the search yields no result, then the user will be informed accordingly.
If the search yields multiple results, then the user will be provided with a list of results and is prompted to select one.
If the search yields a single result, then the result will be run immediately. Be aware that there is no exception for executables or scripts, running these kinds of objects may cause damage under inappropriate circumstances.

Search operation can be refined with modifiers or file attributes. Gof defines the following modifiers:

  • d: Indicates that the directory of the winner must be opened instead.
  • f: Indicates that once a match is encountered, it must be run immediately and the search operation must terminate. This modifier optimizes search in some cases, but it is rarely useful because the file must be proven to occur early, and the wildcard must be proven to be persistently unique.
  • x: Indicates that the wildcard should be used as a literal name.
  • n: Indicates that if a winner is elected, it must be opened with Notepad. This modifier does not work with the attribute 'd'.
  • u: Indicates that if a winner is elected, it must be opened with UEStudio. This modifier does not work with the attribute 'd'.
  • v: Indicates that if a winner is elected, it must be opened with Visual Studio. Visual Studio has some issues where it doesn't succeed in opening '.cs' files if run by Gof. Gof will detect '.cs' files and solve this problem automatically, but by using this modifier, the problem will be bypassed in any case. This modifier does not work with the attribute 'd'.

Gof defines the following file attributes:

  • r: Matches read-only files
  • h: Matches hidden files
  • s: Matches system files
  • d: Matches directories

Gof may require modification of a variable named 'Path' at line 4 in order to work as expected. The variable must be set with any path that qualifies as a viable starting point for search operations. If the path does not exist, then the user will be notified accordingly.

Str

Str copies a string into the clipboard. Given an argument, the string to be copied will be determined by a corresponding string element in 'str.xml' in the content store. Str always ends silently, even if the argument proves to be invalid.

Startup

Startup runs a series of targets defined by 'startup.xml' in the content store. This script is registered at installation so that it is run upon every logon.

Points of Interest

VBSC File Extension

At installation, Autos adds a custom file extension registration for VBScript to the Registry which relies on CScript, unlike the standard '.vbs' file extension which relies on WScript. This addition is committed because CScript offers a more practical way for communicating with the user.

Content Synchronization

The content store contains a batch file named 'sync.bat' which can be used to synchronize an installation of Autos with its source. A source is a location where an uninstalled example of Autos is held for copying to a user folder.

In 'sync.bat', a variable named 'SourceDir' may have to be modified for synchronization to succeed.

Clip

Clip is a simple .NET 2.0 executable located in the script store. Clip solely exists to assist Str with copying text to the clipboard.

Extension

Autos can be extended with additional scripts which also rely on the principle of performing useful operations while given minimal information. For inspiration, you could use Gof to open a text-based YouTube video inventory while having a hypothetical script so that the command 'yt G_FE9kVDO8o' opens a YouTube video.

Control

After installation, the Autos directory can be accessed swiftly with the following key combination: {Win+R -> autos}
This is handy when you have to update the content store.
This is not a feature of Autos, the user directory is always known by the Windows shell and normally Autos should be a child of that directory.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionbootup automation Pin
Member 108600063-Jan-15 4:56
Member 108600063-Jan-15 4:56 
AnswerRe: bootup automation Pin
tc993-Jan-15 6:55
tc993-Jan-15 6:55 
GeneralRe: bootup automation Pin
Member 108600063-Jan-15 14:51
Member 108600063-Jan-15 14:51 
QuestionInclude Source for Clip Pin
Member 108754812-Jan-15 20:47
Member 108754812-Jan-15 20:47 
AnswerRe: Include Source for Clip Pin
tc992-Jan-15 23:38
tc992-Jan-15 23:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.