This notepad can handle bigger files than to the one shiped with Win9x.
Learn How to make windows looking interfaces in HTML.
Interesting use of commondialogs.
Applicationname= "Htanotepad" id= "OHTA" border= "thick"
borderstyle= "normal" caption= "yes" contextmenu= "yes"
Innerborder= "No" maximizebutton= "yes" minimizebutton= "yes"
Navigable= "Yes"
Icon= "Notepad. EXE "scroll=" no "scrollflat=" no "
Selection= "No" showintaskbar= "yes" singleinstance= "no"
sysmenu= "yes" version= "0.3" windowstate= "normal" >
<style type= "Text/css" >
<!--
Body {xfont-family: "Verdana, Arial, Helvetica, Sans-serif";
Font:menu;
Background-color:menu;
Color:menutext;
xfont-size:8pt;
Cursor:default; Auto, text, pointer
}
TABLE {xfont-family: "Arial";
xfont-size:8pt;
Font:menu;
padding:0pt;
border:0pt;
FILTER:progid:DXImageTransform.Microsoft.Alpha (style=0,opacity=90);
}
IFrame {height:expression (document.body.clientheight-menutable.clientheight);
width:100%;
}
TD {border: "1px solid Menu";}
. submenu {position:absolute;top=20;
Background-color:menu;
Border= "2px outset";}
. Menuin {border: ' 1px inset ';}
. Menuover {border: ' 1px outset ';}
. menuout {border: ' 1px solid ';}
. submenuover {background-color:highlight;color:highlighttext;}
. submenuout {background-color:menu;color:menutext;}
-->
</STYLE>
<script language=vbscript>
Option Explicit
Dim Filename,fmodif,lastchildmenu,lastmenu
Fmodif=false ' not modified
DisplayTitle
Set lastchildmenu=nothing
Set lastmenu=nothing
Sub DisplayTitle
If filename= "" Then
Document. title= "sans titre-" & Ohta.applicationname
Else
Document. Title=filename & "-" & Ohta.applicationname
End If
End Sub
'''''''''''''''''''
' File Management '
'''''''''''''''''''
Sub SaveAs
Dim Odlg
Set odlg=createobject ("Mscomdlg.commondialog")
With Odlg
. Dialogtitle= "SaveAs"
. Filter= "scripts|*.vbs;*.hta;*.wsf;*.js| Text files|*.txt| All Files|*.* "
. maxfilesize=255
. Showsave
If. Filename<> "" Then
Filename=. FileName
Save
End If
End With
Set odlg=nothing
DisplayTitle
End Sub
Sub Save ()
Dim fso,f
If filename<> "" Then
Set fso=createobject ("Scripting.FileSystemObject")
Set F=fso. CreateTextFile (Filename,true)
F.write MyFrame.MyText.Value
F.close
Set f=nothing
Set fso=nothing
Else
SaveAs
End If
End Sub
Sub Openit
Dim fso,f
Set fso=createobject ("Scripting.FileSystemObject")
Set F=fso. OpenTextFile (filename,1)
Myframe.mytext.value=f.readall
F.close
Set f=nothing
Set fso=nothing
DisplayTitle
End Sub
Sub Open ()
If Fmodif Then
Select Case Msgbox ("The text in the file" & FileName & "has been changed." _
& vbCrLf & "Do your want to save the changes?", 51,ohta.applicationname)
Case 6 ' Yes
Save
Case 7 ' No
Case 2 ' Cancel
Exit Sub
End Select
End If
Dim Odlg
Set odlg=createobject ("Mscomdlg.commondialog")
With Odlg
. Dialogtitle= "Open"
. Filter= "scripts|*.vbs;*.hta;*.wsf;*.js| Text files|*.txt| All Files|*.* "
. maxfilesize=255
. Flags=. Flags Or &h1000 ' filemustexist (ofn_filemustexist)
. ShowOpen
If. Filename<> "" Then
Filename=. FileName
Openit
End If
End With
Set odlg=nothing
End Sub
Sub NewText
If Fmodif Then
Select Case Msgbox ("The text in the file" & FileName & "has been changed." _
& vbCrLf & "Do your want to save the changes?", 51,ohta.applicationname)
Case 6 ' Yes
Save
Case 7 ' No
Case 2 ' Cancel
Exit Sub
End Select
End If
Myframe.mytext.value= ""
Filename= ""
DisplayTitle
End Sub
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' Drag & Drop '
' ', ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' changeiframe ' &drop
myframe.document.body.innerhtml= "<textarea id=mytext wrap=off OnChange" & _
"= ' vbscript:parent.fmodif=true ' onclick= ' vbscript:parent. Hidemenu ' "& _
" style= ' width:100%;height:100% ' ></textarea> "
with MyFrame.Document.Body.Style
.marginleft=0
.margintop=0
. Marginright=0
.marginbottom=0
end with
with MyFrame.MyText.Style
.fontfamily= "Fixedsys, Verdana, Arial, Sans-serif"
'. fontsize= "7pt"
end with
select case UCase (MyFrame.location.href)
case "About:blank"
filename= ""
Case Else
filename=replace (Mid myframe.location.href,9), "/", "\") ' Suppress file:///
openit
end Select
End Sub
'''''''''''''''''''
' Menu Management '
'''''''''''''''''''
Sub Showsubmenu (Parent,child)
If child.style.display= "Block" Then
Parent.classname= "Menuover"
Child.style.display= "None"
Set lastchildmenu=nothing
Else
Parent.classname= "Menuin"
child.style.display= "Block"
Set Lastchildmenu=child
End If
Set lastmenu=parent
End Sub
Sub Menuover (Parent,child)
If Lastchildmenu is nothing Then
Parent.classname= "Menuover"
Else
If Lastmenu is Parent Then
Parent.classname= "Menuin"
Else
Hidemenu
Showsubmenu Parent,child
End If
End If
End Sub
Sub Menuout (Menu)
If Lastchildmenu is nothing Then menu.classname= "Menuout"
End Sub
Sub Hidemenu
If not Lastchildmenu are nothing Then
Lastchildmenu.style.display= "None"
Set lastchildmenu=nothing
Lastmenu.classname= "Menuout"
End If
End Sub
Sub Submenuover (Menu)
Menu.classname= "Submenuover"
' Lastmenu.classname= ' Menuin '
End Sub
Sub Submenuout (Menu)
Menu.classname= "Submenuout"
End Sub
</script>
<body leftmargin=0 topmargin=0 rightmargin=0>
<table id=menutable><tr>
<TD onclick= ' Showsubmenu me,myfilemenu '
Onmouseover= ' Menuover me,myfilemenu '
onmouseout= ' Menuout Me ' > File </TD>
<TD onclick= ' Showsubmenu me,myeditmenu '
Onmouseover= ' Menuover me,myeditmenu '
onmouseout= ' Menuout Me ' > Edit </TD>
<TD onclick= ' Showsubmenu me,myfindmenu '
Onmouseover= ' Menuover me,myfindmenu '
onmouseout= ' Menuout Me ' > Find </TD>
<TD onclick= ' Showsubmenu me,myhelpmenu '
Onmouseover= ' Menuover me,myhelpmenu '
onmouseout= ' Menuout Me ' >? </TD>
<TD onclick= "Hidemenu" width=100% border=2></td>
</TR></TABLE>
<table id=myfilemenu class=submenu style= "Left=2;display:none;" ><TR>
<TD onclick= "Hidemenu:newtext"
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' > new</td></tr>
<TR><TD onclick= "Hidemenu:open"
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' > open</td></tr>
<TR><TD onclick= "Hidemenu:save"
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' > save</td></tr>
<TR><TD onclick= "Hidemenu:saveas"
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' > Save as</td></tr>
<TR><TD><HR></TD></TR>
<TR><TD onclick= "HideMenu:window.close"
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' > quit</td></tr>
</TABLE>
<table id=myeditmenu class=submenu style= "Left=30;display:none;" ><TR>
<TD><HR width=50px></td></tr>
</TABLE>
<table id=myfindmenu class=submenu style= "Left=60;display:none;" ><TR>
<TD><HR width=50px></td></tr>
</TABLE>
<table id=myhelpmenu class=submenu style= "Left=90;display:none;" ><TR>
<TD onclick= ' Hidemenu:msgbox ' No help available yet;under construction; =) "'
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' >Help</TD></TR>
<TR><TD onclick= ' Hidemenu:createobject ("Mscomdlg.commondialog"). AboutBox '
Onmouseover= ' Submenuover Me '
onmouseout= ' Submenuout Me ' >About</TD></TR>
</TABLE>
<iframe id=myframe application=yes scrolling=no onload= "Changeiframe" ></iframe>
<script language=vbscript>
' We can handle a file as a parameter to this HTA
Dim x
Filename=trim (Ohta.commandline)
X=instr (2,filename, "" "")
If X=len (FileName) Then
Filename= "" ' No File Loaded
Else
Filename=trim (Mid (filename,x+1))
Openit
End If
</script>
</body>