Re: Add Script to (right click) File Options

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: how can I tell if a remote file is an image
    ... If it will image extension (.jpg, ... .gif, .png, etc), so that is picture, otherwise other file type ... The crux of the script is the following: ... > customer run it under php4.2.2 and the getimagesize is taking approx. ...
    (comp.lang.php)
  • Re: A criticism of MS Word 2008
    ... File Type" Deprecation. ... Corentin's script resolves the issue. ... that it is STILL believing the File Type Code. ... From what I've read of this thread you're discussing the WDBN file type ...
    (microsoft.public.mac.office.word)
  • Re: renaming emails
    ... Now save the script again. ... scripts are assigned the file type 'osas' and creator 'ToyS'. ...
    (microsoft.public.mac.office.entourage)
  • Re: Monitor opening of particular extension
    ... You would associate a specific file type with a help application. ... wouldn't "monitor" per say, you would simply call your app or script ...
    (microsoft.public.scripting.vbscript)
  • Re: New Application problems
    ... Somethig in WIN XP changed the .CRD file type so that another app is now ... Windows Registry Editor Version 5.00 ... Double-clicking the filename brings up the file with the right ...
    (microsoft.public.windowsxp.customize)