Re: Add Script to (right click) File Options
- From: "D.R." <a@xxxxx>
- Date: Mon, 9 Jul 2007 21:46:09 +0100
Basically, two places to add, one is for a specific file type, i.e. so that
the right click contect menu option only appears for one file type (or as
many as you create) or, secondly for all files:
Option 1 - For one file type:
Click Start / Control Panel / Folder Options
Click on "File Types" tab
Scroll down to "DOC", and select (i.e. click once)
then click "Advanced" (at the bottom)
then click "New" (on the right)
In "Action" enter the name of your function/action (not the file name)
In "Application used..." enter:
C:\WINDOWS\system32\cscript.exe "Z:\Path\script.vbs" "%1"
N.B. Change "Z:\Path\script.vbs" to point to your script...
Click OK
Click OK
Click Close
Now, when you right click a "DOC" file type you should see your "Action"
name.
Here's a simple script to test it with:
----------------CUT-----------------
Option Explicit
Select Case WScript.Arguments.Count
Case 0
MsgBox "No parameters"
WScript.Quit(1)
Case 1
MsgBox "P1 = `" & WScript.Arguments.Item(0) & "`"
Case Else
MsgBox "Too many parameters"
WScript.Quit(1)
End Select
WScript.Quit(0)
--------------------SNIP------------------
Option 2 - All Files:
Two examples of REG files to create the options, for all files, as follows:
The important thing to note is that these definitions use a "\" as a
meta-character, or as an "escape" character...look at each character
carefully in the examples below, and you'll notive the leading \ before an
embedded quote character, i.e. so that the quote character doesn't terminate
the value of the @= definition, but is instead left inside the sting that
gets saved to the registry.
--------------------CUT--------------------
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\compact]
@="Compact"
[HKEY_CLASSES_ROOT\*\shell\compact\command]
@="\"C:\\WINNT\\system32\\COMPACT.EXE\" /C \"%1\""
-----------------------SNIP----------------------
....and...
------------------------CUT------------------------
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\opennotepad]
@="Open with Notepad"
[HKEY_CLASSES_ROOT\*\shell\opennotepad\command]
@="\"C:\\WINNT\\system32\\NOTEPAD.EXE\" \"%1\""
-------------------------------SNIP------------------
[end]
"jb6000" <jb6000@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B6540ADB-DF6E-490D-AA62-96BD8778CEE2@xxxxxxxxxxxxxxxx
Hello,
I'm not sure if this is the right forum to ask this question but I will
try
it anyway.
I created a script that takes a text file and turns it into a Word doc
complete with the proper formatting required by our accounting staff. So
my
question is, how can I right click on a text file and have the script
appear
on the drop down menu of the file?
TIA
.
- Prev by Date: Re: determine set of attributes
- Next by Date: Re: determine set of attributes
- Previous by thread: determine set of attributes
- Next by thread: Re: ActiveX component can't create object
- Index(es):
Relevant Pages
|