This is a tiny module for modifying the file types and extension association. Uses Win32::Registry2 ( http://www.fmi.cz/private/Jenda ).
!!! Be VERY carefull before you try any of the examples. I tried to make them as harmless as posible, but still they may screw up your computer. Generaly spoken, do NOT use this module unless you realy know what are you doing. !!!
Win32::FileType | Non OO functions | Methods and Constructors
Associates an extension with a file type. The second argument may be either a file type name or a Win32::FileType object.
The file type name is NOT the name you see in the explorer under View\Details, but rather the name of the key specifying the file type. That is you have to use assoc('.rtf','Word.RTF') instead of assoc('.rtf','Rich Text Format').
The extension may, but doesn't have to start with a dot.
Win32::FileType | Non OO functions | Methods and Constructors
Deletes the association of an extension with a file type.
Connect to a remote registry. All newly created objects will point to the remote machine. Returns 1 if successfull, undef otherwise. The previously created objects remain connected to the machine they were.
You may call this function also as a method, in that case it reconnects only the object and doesn't change the machine new objects will be pointing to.
See also Connect
Assoc , Action , DDEAction , DefaultAction , Icon or DefaultIcon, Property , Extensions
Create a new file type. The $file_type_name is the name of key that will contain the file type specification and will be used in ``assoc''. The $title is the text that will be displayed in the Explorer.
If you do not specify the $title, $file_type_name will be used as the title.
If the file type already exists it will be opened. In that case if you do not specify the $title, it will not get changed.
Win32::FileType | Non OO functions | Methods and Constructors
Opens a preexisting file type. You may specify either the file type name or an extension (begining with a dot!).
If you specify a computer name, the function tries to connect the remote registry on that computer.
Win32::FileType | Non OO functions | Methods and Constructors
Sets or retrives the command and title of an action of a file type. If you do not specify the title, the name of the action is used instead.
If you use this method to get the info, you may use either the action subkey name or the action title (the text in local menu) or a regular expression matching the action title. If the $action_name is an empty string, you will get info for the default action.
Win32::FileType | Non OO functions | Methods and Constructors
Associate the extension(s) with this file type. The extension doesn't have to begin with a dot.
Win32::FileType | Non OO functions | Methods and Constructors
Closes the Win32::FileType object and releases the handle to registry. It does exactly the same as ``undef $obj;''.
Win32::FileType | Non OO functions | Methods and Constructors
Connect to the same file type in on a remote computer. Returns a new Win32::FileType object if successfull, undef otherwise.
This method doesn't change the machine new objects will be pointing to.
See also Connect
Win32::FileType | Non OO functions | Methods and Constructors
Sets or retrieves the DDE command and title of an action of a file type. If you do not specify the title, the name of the action is used instead.
If an application supports DDE, it's a very good idea to set up the DDEAction (Shell\action\ddeexec subkey of the file type). This way if you start a document when it's application is already running, the computer doesn't have to launch a new instance of the program, but rather may just tell the existing instance to open a document.
See the docs of the application to see if this is posible, and how should the DDE command look like.
The \%action is a hash (associative array) of form
Win32::FileType | Non OO functions | Methods and Constructors
Deletes the file type from the registry (completely). You may delete several types at once.
Returns the number of successfully deleted types.
Win32::FileType | Non OO functions | Methods and Constructors
Retrieves or sets the name of the default action for the file type.
Win32::FileType | Non OO functions | Methods and Constructors
Searches for all extensions that are mapped to this file type. May take some time to execute.
If evaluated in array context returns an array of the extensions. If evaluated in scalar context returns the number of extensions found. If the first argument is present it will be set to a reference to an array containing the extensions.
Win32::FileType | Non OO functions | Methods and Constructors
Sets or retrives the default icon for this file type. The path may point either to an .ICO file or to an .EXE or .DLL file. In the later case you should provide an index because an .EXE may contain several icons.
Win32::FileType | Non OO functions | Methods and Constructors
Returns the name of the file type. Since I do not know of an easy way to rename a registry key and didn't write a Rename function in Win32::Registry2, this property is read only. I will add Rename and Copy methods later.
Win32::FileType | Non OO functions | Methods and Constructors
Retrieves or sets a value in the main key of the file type. The $type is the registry value type as exported by Win32::Registry2.pm. Default is REG_SZ. If you want to delete a property, specify undef as the value.
Win32::FileType | Non OO functions | Methods and Constructors
Retrieves or sets the title of the file type.
Win32::FileType | Non OO functions | Methods and Constructors
Gives back a registry object opened to a ShellEx subkey of the file type. See Win32::Registry for available functions. Since it is not so widely used I was too lazy to provide any wrapper over this rarely used area.
All other functions retrieve or set the default value of the subkey name_of_the_function of the file type key. You may use it to set the CLSID, CurVer and other values.
Win32::FileType | Non OO functions | Methods and Constructors