Re: Create file associations by mr_unreliable
mr_unreliable
Fri Aug 18 15:51:49 CDT 2006
hi Fred,
You can do this in either of two ways.
For one, you can write the registry with regwrite commands.
Or you can create a "reg" file and then just "run" it. A
"reg" file will call up regedit to make a registry entry
or entries for you.
O.K. for that, so what do you write. Usually there are two
entries. The first entry is for the extension. Say your
extention is ".au3b". Then you make up a registry entry
that looks like this (note the "REGEDIT4" makes it a reg
file):
REGEDIT4
[HKEY_CLASSES_ROOT\.au3b]
@="au3bfile"
So your ".au3b" extension points to ANOTHER registry entry,
namely "au3bfile" (the same as the extension, with "file"
appended).
Here is what the other registry entry looks like:
REGEDIT4
[HKEY_CLASSES_ROOT\au3bfile]
@="AutoIt v3(beta) Source File"
"EditFlags"=hex:00,00,00,00
"AlwaysShowExt"=""
[HKEY_CLASSES_ROOT\au3bfile\Shell]
@="Run"
[HKEY_CLASSES_ROOT\au3bfile\Shell\Run]
"EditFlags"=hex:01,00,00,00
[HKEY_CLASSES_ROOT\au3bfile\Shell\Run\command]
@="D:\\AutoIt3(beta_v123)_06May06\\AutoIt3.exe \"%1\""
[HKEY_CLASSES_ROOT\au3bfile\Shell\EditPlus]
@="Edit &with EditPlus"
[HKEY_CLASSES_ROOT\au3bfile\Shell\EditPlus\command]
@="D:\\TEXTED~1\\EDITPLUS\\EDITPLUS.EXE"
[HKEY_CLASSES_ROOT\au3bfile\Shell\EditPlus\ddeexec]
@="[open(\"%1\")]"
[HKEY_CLASSES_ROOT\au3bfile\Shell\Open]
"EditFlags"=hex:01,00,00,00
[HKEY_CLASSES_ROOT\au3bfile\Shell\Open\command]
@="D:\\AutoIt3(beta_v123)_06May06\\AutoIt3.exe \"%1\""
[HKEY_CLASSES_ROOT\au3bfile\Shell\Edit_with_SciTE]
"EditFlags"=hex:01,00,00,00
@="Edit with SciTE"
[HKEY_CLASSES_ROOT\au3bfile\Shell\Edit_with_SciTE\command]
@="d:\\SciTE_4AutoIt3_14Mar06\\SciTe.exe \"%1\""
[HKEY_CLASSES_ROOT\au3bfile\DefaultIcon]
@="D:\\AutoIt3(beta_v123)_06May06\\AutoIt3.exe,0"
Yes, that is a little verbose, but hey, that's what you
need. If you look carefully, you will see "pairs" of
subkeys. The first item will be the context menu item
("Run"), and the second item of the pair will be the
command ("D:\\AutoIt3(beta_v123)_06May06\\AutoIt3.exe \"%1\"")
Upon further inspection, you will see how to specify the
icon you want to show for your filetype.
As we said, you could make up that text in your script and
then use regwrite to get it into the registry. Or, you could
use the above as regfile templates, modify it using a text
editor, and then just use your script with oShell.Run to run
those "reg" files using regedit.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
Fred wrote:
> Can someone tell me how to create a file association using VBS.
> i.e. I want to setup files with a file extension of ".myExt" to be opened
> using .../myProg.exe and I want to set the icon on these files.
>
> Thanks for any help
> Fred
>
>
>