A notepad made in HTA(hta实现的记事本)(阿耨多罗三藐三菩提什么意思)一看就会

随心笔谈2年前发布 编辑
177 0
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

<html><head>

 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”>

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>

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 you 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 you 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 ‘

”””””””’

Sub ChangeIFrame

 ‘We use an Iframe to allow Drag&Drop

 MyFrame.Document.Body.InnerHTML=”

  “=’vbscript:parent.fModif=True’ onclick=’vbscript:parent.HideMenu’ ” & _

  “style=’width:100%;height:100%’>”

 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 is 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

</head>

  onmouseover=’MenuOver Me,MyFileMenu’

  onmouseout=’MenuOut Me’> File

  onmouseover=’MenuOver Me,MyEditMenu’

  onmouseout=’MenuOut Me’> Edit

  onmouseover=’MenuOver Me,MyFindMenu’

  onmouseout=’MenuOut Me’> Find

  onmouseover=’MenuOver Me,MyHelpMenu’

  onmouseout=’MenuOut Me’> ?

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’> New

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’> Open

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’> Save

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’> Save As

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’> Quit

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’>Help

  onmouseover=’Submenuover Me’

  onmouseout=’Submenuout Me’>About

 </TABLE>

<iframe id=MyFrame application=yes scrolling=no onload=”ChangeIFrame”></iframe>

‘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

© 版权声明

相关文章