Replacing notepad

  • Thread starter CarolineS aka shadoe
  • Start date
C

CarolineS aka shadoe

Is there any way I can safely replace my Notepad with TextPad?? I've tried Google and all I get are complicated solutions by editing the registry. I'm not sure I can do that. Actually, I want Textpad to open html source files instead of notepad. Anybody really know how??
Caroline
 
D

David Candy

Changing the View Source Program
A registry key controls what editor is used when a user clicks View Source on either the View menu or the context menu in Internet Explorer 5.

Because IE5 passes a long file name without using quotation marks most editors won't work. This tip uses a vbs program and a registry file to allow any editor to be used.

The Registry File
This registry file sets VSource.vbs as the View Source editor. It assumes that VSource.vbs is in the C:\Program Files\Internet Explorer folder. Edit the path between the inverted commas to where you have put VSource.vbs. Note that as this path has a space in it the path must be enclosed in quotation marks. In a reg file quotation marks a written as \" and backslashes in paths are written as \\ . Because backslashes and inverted commas are used in registry files (backslashes seperate keys and inverted commas enclose string values) the backslash tell Regedit that the next character is part of the value, so with a double backslash only a single backslash is put into the registry and with backslash followed by inverted comma only the inverted comma is put into the registry.

Or edit it with any editor you wish to use. The editor must support long file names without being enclosed in quotation marks (only Notepad as far as I know).

Copy these lines into a new blank Text Document, edit it to suit, name it VSource.reg, double click it.

REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\View Source Editor\Editor Name]
@="\"C:\\Program Files\\Internet Explorer\\VSource.VBS\""
To uninstall get RegDelete from the Help Page and type

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\View Source Editor\in it, or type in the Start - Run dialog

RegDelete "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\View Source Editor\"The VBS File
This vbs file collects the file name and makes it acceptable to any program. It formats it for 16 bit programs (short file name such as Windows 3.1 or MS-Dos programs as I use a Windows 3.1 program called SPAD.EXE instead of Notepad) or 32 bit programs (long file name such as Windows 95 programs).

As it is here it is setup to use Wordpad as the editor (assuming it's in C:\Program Files\Accessories. By altering LFN="Yes" to LFN="no" it will use MS-Dos Edit.com (again assuming it's installed to C:\Windows\Command).

Read the file and edit it to suit, it commented as to where it should be edited.

It requires scrrun.dll which is distributed in various Microsof't products. If you don't have it download it from Microsoft's web site.

Copy these lines into a new blank Text Document, edit it to suit, name it VSource.vbs, copy it to the folder specified in the registry file..

'VSOURCE.VBS
'Enables any editor to be used with the View Source command in Internet Explorer 5
'You also need to use the reg file supplied with this file to set this up
'Edit between the inverted commas to set up your editors.
'Don't insert any inverted commas, the programs does that stuff itself
'As supplied it is using short file names with MS-Dos Editor in 43 line mode read only, changing
'LFN to equal yes will use Wordpad

'Serenity Macros http://www.angelfire.com/biz/serenitymacros
'David Candy (e-mail address removed)
'
'=========================================================
'Tell VSOURCE.VBS if it your editor uses long or short
'file names here
'yes or no
'---------------------------------------------------------

LFN="yes"

'=========================================================
'Change program to use here. 16bit is sfn and 32 bit is lfn
'---------------------------------------------------------

sfnProgName="C:\windows\command\edit.com"

'or perhaps
'
lfnProgName="C:\Program Files\Accessories\WORDPAD.EXE"

'=========================================================
'Change switches the editor may use here. 16bit is sfn and
'32 bit is lfn. If you don't know try removing characters
'between the inverted commas.
'---------------------------------------------------------

'Sets edit to be read only and 43 line display
sfnSwitches="/h /r"
lfnSwitches=""
'=========================================================

On Error Resume Next

Dim Sh
Set Sh = WScript.CreateObject("WScript.Shell")
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Wscript.ScriptName & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
Sh.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "\", Chr(34) & Wscript.ScriptFullName & Chr(34)
ReportErrors "Updating App Paths"
Dim Ag
Set Ag=Wscript.Arguments
ReportErrors "Creating Script Objects"

For x=0 to Ag.Count -1
CmdLine=CmdLine & Ag(x) & " "
Next

lfnProgName=Chr(34) & lfnProgName & Chr(34)
sfnProgName=Chr(34) & sfnProgName & Chr(34)
If lfnSwitches<>"" then lfnSwitches=lfnSwitches & " "
If sfnSwitches<>"" then sfnSwitches=sfnSwitches & " "

If LCASE(LFN)="yes" then
CmdLine=Chr(34) & CmdLine & Chr(34)
CmdLine=lfnProgName & " " & lfnSwitches & cmdline
Else
CmdLine=sfnProgName & " " & sfnSwitches & ShortPath(cmdline)
End If

sh.run CmdLine

ReportErrors "Main"

Sub ReportErrors(strModuleName)
If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
Err.clear
End Sub

Function ShortPath(filespec)
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(filespec)
ShortPath = UCase(f.ShortPath)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top