Sign in to follow this  
Followers 0
Mat

Creating File types and extensions + context menu items

3 posts in this topic

#1 ·  Posted (edited)

It is fairly common knowledge that you can create file types such as .au3 in the registry, and also that you can make context menu items by writing to shell\command too. This is just a UDF I put togethor that does just that!

***Functions:***

* RegCheckExt

Checks to see if a given extension is valid, and returns accordingly, also returns though if the extension is valid as a file type, so you can check if AutoItScript is valid. It also runs a check if all else fails to see if it would be valid if you add a dot to the front, so you can search for just au3, and it will return.

* RegGetFileType

Gets the filetype from an extension, so if you type .au3, will return with autoit3script. It also validates the answer to make sure that the filtype exists, and hasn't been deleted.

* RegCreateExt

Creates a file type and an extension as well as associating an icon with it. I have made an extension on my computer specifically for testing the features listed here called .test, the file type is testing file, description is a file for testing stuff, etc.

* RegRemoveExt

Removes an extension and its corresponding file type from the computer, this can cause havoc if you let it, as youi can delete any extension, and end up with the computer not recognizing (and not being able to do anything) with .txt files or .doc etc.

* RegCreateContextItem

Creates a context menu item under the specified extension/filetype. you can use this to say add Open to a .test extension, set the command to notepad.exe and params to %1.

* RegRemoveContextItem

Removes all entries for a context menu item, a very simple code, that like regremoveext, can cause a fair bit of trouble on your pc, if you know what the command is though, then you can just remake it with RegCreateContextItem.

* RegGetContextDefault

Returns with the default action on double clicking a file with the specified extension/file type.

* RegGetContextAll

Returns an array with all the context menu of a given extension. This is not neccesarily all of them though, to get a full list, do another search for all context items under an extension of "*".

Thanks to the saint who sent me his script that he used to make .tale files for tall tales, they helped a lot! ^_^

Download Link

Downloads so far shown on the downloads page.

I also threw togethor a couple of GUI's that show the kind of stuff you can do, I was contemplating writing a full suite, but times a major factor, and cba. These GUI's require that the udf is put in the includes folder.

Oh, and forgot to add: for the first GUI, the icon doesnt' change... I need to sort that one out, GUICtrlSetData doesn't seem to work with an icon...

There will as always be errors, so sorry, just post the error and a if you feel like being nice, a script to solve it, and I will upload the edited version.

Have a nice day!

Mat

Updated download link @ 12 March 2010

Edited by Mat

Share this post


Link to post
Share on other sites



Nice idea, didn't test it (yet), but for sure will do ^_^. Thanks for your efforts!

Thanks!

Does anyone know if there is a way i can write to the context menu's of windows? and possibly return the title or even better, the handle as a parameter? that could be good!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0