Jump to content

File Extension open..


Recommended Posts

Hi, how to set for some extension default program for open?

i want to set for *.txt extension, to be my script default opener...

Do you mean for files to be chosen by the user? Then FileOpenDialog has a filter for the extensions.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

No, i want to change by the script default extension opener program.... for txt extension is Notepad by default, and i want to change it with my script... if is possible...

Posted Image

Edited by dzony91
Link to comment
Share on other sites

This should work on XP, but exclude the first line if you don't want to change the look of the right-click context menu.

RegWrite("HKEY_CLASSES_ROOT\txtfile\shell\open", "", "REG_SZ", "ScitTe")
RegWrite("HKEY_CLASSES_ROOT\txtfile\shell\open\command", "", "REG_SZ", '"C:\Program Files\AutoIt3\SciTE\SciTe.exe" "%1"')

A Sysinternals program called Registry Monitor is good for finding out what registry changes are made by manually changing a file association the normal way.

Das Häschen benutzt Radar

Link to comment
Share on other sites

This should work on XP, but exclude the first line if you don't want to change the look of the right-click context menu.

RegWrite("HKEY_CLASSES_ROOT\txtfile\shell\open", "", "REG_SZ", "ScitTe")
RegWrite("HKEY_CLASSES_ROOT\txtfile\shell\open\command", "", "REG_SZ", '"C:\Program Files\AutoIt3\SciTE\SciTe.exe" "%1"')

A Sysinternals program called Registry Monitor is good for finding out what registry changes are made by manually changing a file association the normal way.

You maybe better off creating a new filetype rather then overwriting a default filetype. To get a list of filetypes then type "ftype|more" in a command prompt window

Example to associate to a filetype.

RegWrite("HKCR\.txt", "", "REG_SZ", "SciTe")
RegWrite("HKCR\Scite\shell\open\command", "", "REG_SZ", '"C:\Program Files\AutoIt3\SciTE\SciTe.exe" "%1"')oÝ÷ Øò¢ìÛh­ën®{h¶yö®×âër¥ëaz|¨»
.Ö®¶­se&VtFVÆWFRgV÷C´´5"b3#µ66FRgV÷C²¥&Vuw&FRgV÷C´´5"b3#²çGBgV÷C²ÂgV÷C²gV÷C²ÂgV÷Cµ$Tuõ5¢gV÷C²ÂgV÷C·GFfÆRgV÷C²

:)

Link to comment
Share on other sites

Meaning all due respect to an MVP, what the heck kind of key is this: "HKCR\Scite\shell\open\command" ?

My code has been tested on XP - you'd better backup all these keys before you start messing around with this: Use RegRead and backup its return value. Changes should take effect at least after logging of and then on again - but might take place immediately.

Edited by Squirrely1

Das Häschen benutzt Radar

Link to comment
Share on other sites

Meaning all due respect to an MVP, what the heck kind of key is this: "HKCR\Scite\shell\open\command" ?

Example code as stated. Consider if executed compared to your example. The difference is mine has a good chance of not overwriting if the key does not exist but your example definitely does.

My code has been tested on XP - you'd better backup all these keys before you start messing around with this: Use RegRead and backup its return value. Changes should take effect at least after logging of and then on again - but might take place immediately.

Your code overwrites the default setting of a notepad association within a default key. Are you absolutely sure that as correct, safe and/or wanted? As you state, backup is good advice as working with the registry if you do not know what you are doing or mess up. The Scite key does not exist on my system so will not mess up a setting but your does make a change to data within a default key. If you use Assoc and Ftype then changes are immediate.

Setting a association by UDF here

It is the M$ CLI way of doing it which is similar to which I base my example above. :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...