I wany to put the following in the HTA <body>

<TABLE><TR><TD><A href=001.txt>001</A></TD><TD><A href=002.txt>002</
A></TD></TR>
</TABLE>
The idea being the user clicks on the link and it brings up Notepad.

>From what I've read I believe something like the following needs to be
in the script.
Set objNotepad = CreateObject("Notepad.Application")
objNotepad.Visible = True

but this gives an Active-X error and even if it didn't give an error I
don't know what to do after that.

Thanks in anticipation

Richard

Re: HTA to hyperlink to Notepad by Paul

Paul
Fri Sep 07 04:27:22 PDT 2007

<richard.clayton@office2office.biz> wrote in message
news:1189158160.364049.177410@o80g2000hse.googlegroups.com...
>I wany to put the following in the HTA <body>
>
> <TABLE><TR><TD><A href=001.txt>001</A></TD><TD><A href=002.txt>002</
> A></TD></TR>
> </TABLE>
> The idea being the user clicks on the link and it brings up Notepad.
>
>>From what I've read I believe something like the following needs to be
> in the script.
> Set objNotepad = CreateObject("Notepad.Application")
> objNotepad.Visible = True
>
> but this gives an Active-X error and even if it didn't give an error I
> don't know what to do after that.
>
> Thanks in anticipation

Wouldn't it be nice if every program you use could be treated as a COM
object? Well, a whole lot of programming goes into this interaction between
programs. Many (probably most) programs do not have a COM interface.
Notepad does not. It cannot be used with the CreateObject() statement.

The windows OS comes with lots of COM objects you can use in scripts, like
Internetexplorer.application. You need an 'object browser' to find out what
they are and what properties, methods, events, etc. are associated with
these objects. Each of the M$ Office applications include a form of VBA and
an editor. The editor includes the capability to browse the objects on your
computer. TLViewer is one free third-party object browser which I like
better. It is available at http://www.tlviewer.org/tlviewer/index.htm.

There are other ways to start and run an application. You might use the
shell.application object to run a command; this command might be Notepad
followed by the name of a file that you want to open in notepad. I don't
recall whethe the <href ...> tag can be used to shell run Notepad; I think
it might require some JScript. Hopefully someone else will present an
example.

Do you want Notepad to just display the text, manipulate the text within
notepad or print it? Notepad has some command line options available.

-Paul Randall



Re: HTA to hyperlink to Notepad by John

John
Fri Sep 07 05:13:43 PDT 2007


<richard.clayton@office2office.biz> wrote in message news:1189158160.364049.177410@o80g2000hse.googlegroups.com...
>I wany to put the following in the HTA <body>
>
> <TABLE><TR><TD><A href=001.txt>001</A></TD><TD><A href=002.txt>002</
> A></TD></TR>
> </TABLE>
> The idea being the user clicks on the link and it brings up Notepad.
>
>>From what I've read I believe something like the following needs to be
> in the script.
> Set objNotepad = CreateObject("Notepad.Application")
> objNotepad.Visible = True
>
> but this gives an Active-X error and even if it didn't give an error I
> don't know what to do after that.
>
> Thanks in anticipation
>
> Richard
>

Try this. The 'return false;' prevents the browser opening the file as well as Notepad.

<HTA:Application/>
<html>
<head>
<script language="VBScript" type="text/vbscript">
Option Explicit
Sub Open_Notepad (element)
Dim objShell, fs, sFilename

fs = InstrRev(element.href,"/")
sFilename = Mid(element.href,fs+1)
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "notepad.exe " & sFilename
End Sub
</script>
</head>
<body>
<TABLE ID="Table1">
<TR>
<TD><A href=001.txt onclick="javascript:Open_Notepad(this);return false;">001</A></TD>
<TD><A href=002.txt onclick="javascript:Open_Notepad(this);return false;">002</A></TD>
</TR>
</TABLE>
</body>
</html>



Re: HTA to hyperlink to Notepad by richard

richard
Fri Sep 07 05:40:13 PDT 2007

Thanks for this - just the job !!


On Sep 7, 1:13 pm, "John W" <johnawilliamsaesqu...@agmail.com> wrote:
> <richard.clay...@office2office.biz> wrote in messagenews:1189158160.364049.177410@o80g2000hse.googlegroups.com...
> >I wany to put the following in the HTA <body>
>
> > <TABLE><TR><TD><A href=001.txt>001</A></TD><TD><A href=002.txt>002</
> > A></TD></TR>
> > </TABLE>
> > The idea being the user clicks on the link and it brings up Notepad.
>
> >>From what I've read I believe something like the following needs to be
> > in the script.
> > Set objNotepad = CreateObject("Notepad.Application")
> > objNotepad.Visible = True
>
> > but this gives an Active-X error and even if it didn't give an error I
> > don't know what to do after that.
>
> > Thanks in anticipation
>
> > Richard
>
> Try this. The 'return false;' prevents the browser opening the file as well as Notepad.
>
> <HTA:Application/>
> <html>
> <head>
> <script language="VBScript" type="text/vbscript">
> Option Explicit
> Sub Open_Notepad (element)
> Dim objShell, fs, sFilename
>
> fs = InstrRev(element.href,"/")
> sFilename = Mid(element.href,fs+1)
> Set objShell = CreateObject("Wscript.Shell")
> objShell.Run "notepad.exe " & sFilename
> End Sub
> </script>
> </head>
> <body>
> <TABLE ID="Table1">
> <TR>
> <TD><A href=001.txt onclick="javascript:Open_Notepad(this);return false;">001</A></TD>
> <TD><A href=002.txt onclick="javascript:Open_Notepad(this);return false;">002</A></TD>
> </TR>
> </TABLE>
> </body>
> </html>- Hide quoted text -
>
> - Show quoted text -



HTA to display edit control by mr_unreliable

mr_unreliable
Fri Sep 07 08:26:54 PDT 2007

Although you can't instantiate Notepad, due to its lack
of an automation interface, there are any number of actx
controls out there which you _can_ instantiate from an HTA
(or IE, or vb, or... ).

You might start with the html "TextArea" control. Not
very sophisticated, but you can type into it, erase and
correct your typing, and save the result.

Then there is the ms "Rich Textbox" control (richtx32.ocx),
which may or may not be installed on your computer (probably
is if you have vb), but even if not you may find it on one
of the dll download sites. RichEdit -- for those not
familiar with it -- is basically what you get with the
ms wordpad app (generally considered to be one step up
from notepad.

If you are willing to go third-party, I would suggest
Steve McMahon's (vbAccelerator) vbalRichEdit control.
Steve sets out to do a better job of it than microsoft,
and generally succeeds:

http://www.vbaccelerator.com/codelib/richedit/richedit.htm

I googled around for other edit controls, and came across
"FreeTextBox" at: http://freetextbox.com/default.aspx

FreeTextBox looks promising. Very capable and compatible
with html. If you insist on having the source, they charge
for that.

And finally, for an edit control that probably has more
capability than you really want, take a look at "Scintilla":

http://www.scintilla.org/

Scintilla is an actx control that serves as the basis for
several programmer's editors. It has all the standard
text editing capabilities, plus "syntax-highlighting" for
several programming languages.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)