Command Reference

Read File Association

Stores the full path to the executable associated with a specific file extension (i.e. the associated viewer for that file type) in a variable.

You supply a file extension such as ".txt" and the variable will be set to the location of the executable associated with that file type on the user's system.

Action ID: 20
Action Category: File Information

Settings

Variable name

The name of the variable to store the result in.

Default value

The default value for the variable if the association cannot be determined.

File extension

The extension in "ext" or ".ext" format, i.e., with or without the dot ('.').

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

Could not read file association.

Could not open key.
<<File extension>>

2

Could not read file association.

Could not read value.
<<File extension>>

3

Could not read file association.

Invalid file type.
<<File extension>>

4

Could not read file association.

File not found.
<<File extension>>

Examples

Example 1

In this example, we will find out the path and filename of the default text viewer on the user's system.

Variable name: %TextViewerLocation%
Default value: Not Found
File extension: .txt

Example 2

In this example, we will find out the full path and filename of the user's copy of AutoPlay Menu Studio 3.0.

Variable name: %AutoPlayLocation%
Default value: Not Installed
File extension: .am3

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab