Jump to content

yet another auto-open problem...


rakudave
 Share

Recommended Posts

i'm sure you all know that for example .txt files will automatically be opened in the notepad...

heres my question:

are there some reg-entries to change that automatically?

(yes i know: contextmenu: open with... notepad... but is there another way?)

i need it for a script that opens files in my own programm.

it works fine if you manually change it, but i can't expect that every user knows how to... :-/

Edited by rakudave
Link to comment
Share on other sites

i'm sure you all know that for example .txt files will automatically be opened in the notepad...

heres my question:

are there some reg-entries to change that automatically?

(yes i know: contextmenu: open with... notepad... but is there another way?)

i need it for a script that opens files in my own programm.

it works fine if you manually change it, but i can't expect that every user knows how to... :-/

Here is a quick (and dirty) way to change it: In your registry, go to HKEY_Classes_Root and delete the ".txt" entry. This will kill the association to any program trying to open ".txt" files. So the next time you open a ".txt" file, it will ask you what program you want to use to open it. Be sure to check the box that says, "Always use this program..."

You can also use Windows Explorer and go to Tools -> Folder Options... -> File Options [tab] and then edit the default program which opens text files.

Link to comment
Share on other sites

Look at Registry keys: HKEY_CLASSES_ROOT\.txt and HKEY_CLASSES_ROOT\txtfile

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.txt]@="txtfile"

"PerceivedType"="text"

"Content Type"="text/plain"

[HKEY_CLASSES_ROOT\.txt\PersistentHandler]

@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\.txt\ShellNew]

"NullFile"=""

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\txtfile]

@="Text Document"

"FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\

00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,\

32,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,\

00,2c,00,2d,00,34,00,36,00,39,00,00,00

"EditFlags"=dword:00010000

[HKEY_CLASSES_ROOT\txtfile\DefaultIcon]

@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,68,00,\

65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,00,35,\

00,32,00,00,00

[HKEY_CLASSES_ROOT\txtfile\shell]

[HKEY_CLASSES_ROOT\txtfile\shell\open]

[HKEY_CLASSES_ROOT\txtfile\shell\open\command]

@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\

00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\

54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\

00

You need to create [HKEY_CLASSES_ROOT\txtfile\shell\open\command] with path of desired exe and flag for extension [HKEY_CLASSES_ROOT\.txt]
Link to comment
Share on other sites

i whant to introduce a new file format: .sdk

You don't have to use the registry, just use SerialKiller's idea on your .sdk file. However, you may find that "sdk" is used as it is a known file type:

So the next time you open a ".txt" file, it will ask you what program you want to use to open it. Be sure to check the box that says, "Always use this program..."

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

O.K. this is simple Windows .SDK shell extension with association to "scritpt.exe" located in "C:\Documents and Settings\--\Desktop\script.exe".

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SDK","Application","REG_SZ",'script.exe') ; extension & flag

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SDK\OpenWithList","a","REG_SZ",'script.exe') ; can be added more associations (b, c, d, ...)

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.SDK\OpenWithList","MRUList","REG_SZ",'a') ; to use association

RegWrite("HKEY_CURRENT_USER\Software\Classes\Applications\script.exe\shell\open\command","","REG_SZ",'"C:\Documents and Settings\--\Desktop\script.exe" "%1"') ; loacation of program associated

Link to comment
Share on other sites

O.K. this is simple Windows .SDK shell extension with association to "scritpt.exe" located in "C:\Documents and Settings\--\Desktop\script.exe".

That's NICE! Thank you...
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
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...