hta实现的二进制文件转换为文本_hta

保存为.hta运行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>package file v0.1</title> 
<meta http-equiv="Content-Type" content="text/html; charset=GB2312"> 
<HTA:APPLICATION     
     ID="package file v0.1"     
     APPLICATIONNAME="package file v0.1"     
     VERSION="0.1"     
     SCROLL="no"     
     INNERBORDER="no"     
     CONTEXTMENU="yes"     
     CAPTION="yes"     
     ICON="no"     
     SHOWINTASKBAR="yes"     
     SINGLEINSTANCE="yes"     
     SYSMENU="yes"     
     MAXIMIZEBUTTON ="no" 
     WINDOWSTATE="normal" 
     NAVIGABLE="yes" 
     /> 
<SCRIPT LANGUAGE="VBScript"> 
function transfert() 
     dim filename 
     filename = document.getElementById("srcFile").value 
     if len(filename)>0 then 
             dim oReq         
             'on error resume next 
             '//创建XMLHTTP对象 
             set oReq     = CreateObject("MSXML2.XMLHTTP") 
                 oReq.open "get","file:\\" & filename,false 
                 oReq.send     
             ff = oReq.responseBody 
             dim u,s,kk 
             u = lenb(ff) 
             redim kk(u-1) 
             for i=0 to u-1 
                 s = hex(ascb(midb(ff,i+1,1))) 
                 if len(s)<2 then 
                     s = "0" & s 
                 end if 
                 'kk = kk & s 
                 kk(i) = s 
             next 
             make filename,join(kk,"") 
     else 
             document.getElementById("srcFile").focus 
             msgbox "请选择要压缩的文件",16,"提示" 
     end if 
end function 
function make(filename,data) 
     dim htm,file 
     file = mid(filename,instrrev(filename,"\")+1) 
     htm = htm & "<html>"                             & vbcrlf 
     htm = htm & "<head>"                             & vbcrlf 
     htm = htm & "<title>selfdec</title>"     & vbcrlf 
     htm = htm & "<meta http-equiv=""Content-Type"" content=""text/html; charset=GB2312"">" & vbcrlf 
     htm = htm & "<HTA:APPLICATION "                 & vbcrlf 
     htm = htm & "     ID=""selfdec"" "             & vbcrlf 
     htm = htm & "     APPLICATIONNAME=""self"" " & vbcrlf 
     htm = htm & "     VERSION=""0.1"" "             & vbcrlf 
     htm = htm & "     SCROLL=""no"" "                 & vbcrlf 
     htm = htm & "     INNERBORDER=""no"" "     & vbcrlf 
     htm = htm & "     CONTEXTMENU=""no"" "     & vbcrlf 
     htm = htm & "     CAPTION=""no"" "             & vbcrlf 
     htm = htm & "     ICON=""no"" "                 & vbcrlf 
     htm = htm & "     SHOWINTASKBAR=""no"" "     & vbcrlf 
     htm = htm & "     SINGLEINSTANCE=""yes"" "& vbcrlf 
     htm = htm & "     SYSMENU=""no"" "             & vbcrlf 
     htm = htm & "     MAXIMIZEBUTTON =""no""" & vbcrlf 
     htm = htm & "     WINDOWSTATE=""normal""" & vbcrlf 
     htm = htm & "     NAVIGABLE=""yes"""             & vbcrlf 
     htm = htm & "     />"                                 & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "<SCRIPT LANGUAGE=""VBScript"">"             & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "'//保存文件"                     & vbcrlf 
     htm = htm & "function saveFile(filename,str)"             & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     set adodbStream = CreateObject(""ADODB"" & ""."" & ""Stream"")" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     adodbStream.Type= 1"     & vbcrlf 
     htm = htm & "     adodbStream.Open"             & vbcrlf 
     htm = htm & "     adodbStream.write str"     & vbcrlf 
     htm = htm & "     adodbStream.SaveToFile filename,2" & vbcrlf 
     htm = htm & "     adodbStream.Close"             & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "end function"                     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "'//VB数组转变成二进制格式" & vbcrlf 
     htm = htm & "Function MultiByteToBinary(MultiByte)" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     Dim RS, LMultiByte, Binary"                 & vbcrlf 
     htm = htm & "     Const adLongVarBinary = 205"             & vbcrlf 
     htm = htm & "     Set RS = CreateObject(""ADODB.Recordset"")" & vbcrlf 
     htm = htm & "     LMultiByte = LenB(MultiByte)"             & vbcrlf 
     htm = htm & "     If LMultiByte>0 Then"     & vbcrlf 
     htm = htm & "             RS.Fields.Append ""mBinary"", adLongVarBinary, LMultiByte"     & vbcrlf 
     htm = htm & "             RS.Open"                 & vbcrlf 
     htm = htm & "             RS.AddNew"                 & vbcrlf 
     htm = htm & "             RS(""mBinary"").AppendChunk MultiByte & ChrB(0)"                 & vbcrlf 
     htm = htm & "             RS.Update"                 & vbcrlf 
     htm = htm & "             Binary = RS(""mBinary"").GetChunk(LMultiByte)"                     & vbcrlf 
     htm = htm & "     End If"                             & vbcrlf 
     htm = htm & "     MultiByteToBinary = Binary"                 & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "End Function"                     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "function DeleteMe()"             & vbcrlf 
     htm = htm & "     "                                 & vbcrlf 
     htm = htm & "     dim filename"                 & vbcrlf 
     htm = htm & "     filename     = document.location.href" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     filename     = mid(filename,instrrev(filename,""/"")+1)" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     Dim fso, MyFile"             & vbcrlf 
     htm = htm & "     Set fso             = CreateObject(""Script" & "ing.FileS" & "ystemObject"")     " & vbcrlf 
     htm = htm & "     Set MyFile     = fso.GetFile(filename)" & vbcrlf 
     htm = htm & "             MyFile.Delete"             & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "end function"                     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "function exec()"                 & vbcrlf 
     htm = htm & "     "                                 & vbcrlf 
     htm = htm & "     '//屏蔽错误"                 & vbcrlf 
     htm = htm & "     'on error resume next"     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//改变窗体大小"             & vbcrlf 
     htm = htm & "     window.resizeTo 0,0"     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     dim data,t,kk,filename" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//得到数据"                 & vbcrlf 
     htm = htm & "     data             = document.getElementById(""divData"").innerText" & vbcrlf 
     htm = htm & "     '//得到文件名"                 & vbcrlf 
     htm = htm & "     filename     = document.getElementById(""divFileName"").innerText" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//得到数据长度"             & vbcrlf 
     htm = htm & "         u = len(data)"                 & vbcrlf 
     htm = htm & "     "                                 & vbcrlf 
     htm = htm & "     '//获得文件数组"             & vbcrlf 
     htm = htm & "     for i=1 to u step 2"     & vbcrlf 
     htm = htm & "             t = mid(data,i,2)"     & vbcrlf 
     htm = htm & "             kk = kk & ChrB(clng(""&H"" & t))" & vbcrlf 
     htm = htm & "     next"                             & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//转变成二进制格式"     & vbcrlf 
     htm = htm & "     dataArry = MultiByteToBinary(kk)"     & vbcrlf 
     htm = htm & "     "                                 & vbcrlf 
     htm = htm & "     '//保存文件     "                 & vbcrlf 
     htm = htm & "     saveFile filename,dataArry"                 & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//删除自己"                 & vbcrlf 
     htm = htm & "     DeleteMe"                     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "     '//关闭自己"                 & vbcrlf 
     htm = htm & "     window.opener = nothing"& vbcrlf 
     htm = htm & "     window.close"                 & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "end function"                     & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "<" & "/SCRIPT>"                 & vbcrlf 
     htm = htm & "<" & "/head>"                     & vbcrlf 
     htm = htm & "<body marginleft=0 marginright=0 onload=""exec()"">" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "<div id=""divFileName""     style=""display:none;"">" & file & "</div>" & vbcrlf 
     htm = htm & "<div id=""divData""             style=""display:none;"">" & data & "</div>" & vbcrlf 
     htm = htm & ""                                     & vbcrlf 
     htm = htm & "</body>"                             & vbcrlf 
     htm = htm & "</html>"                             & vbcrlf 
     dim fso,f 
     dim this_file 
             this_file = file & "-pf.hta" 
     Set fso = CreateObject("Scripting.FileSystemObject") 
     Set f = fso.OpenTextFile(this_file, 2, True) 
             f.Write htm 
     msgbox "生成文件" & this_file & "成功!",64,"生成" 

end function 

</SCRIPT> 
</head> 
<body marginleft=0 marginright=0 onload="window.resizeTo 389,145 "> 
请选择文件:<input type=file id="srcFile" style="width:260px;"><br><br> 
                 <input type=button value="     转换     " onclick="transfert">     <input type=button value="     关闭     " onclick="window.close"> 
</body> 
</html> 

时间: 2024-07-28 16:43:42

hta实现的二进制文件转换为文本_hta的相关文章

二进制文件转换为文本工具_hta

保存为.hta运行 复制代码 代码如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>package file v0.1</title> <meta http-equiv="Content-Type" content="text/html; charset=GB231

用vbs如何确定在 HTA 中选择了哪些文本?_hta

问: 您好,脚本专家!如何确定在 HTA 中选择了哪些文本? -- DO 答: 您好,DO.您知道,大多数人认为每天编写"您好,脚本专家!"专栏是世界上最吸引人.最令人兴奋的工作之一.如果编写此专栏的脚本专家不这么懒惰的话,也许是这样.比如说,很多时候他选择自己认为可以编成脚本的问题.通常他手头没有能完成问题中提到的任务的脚本,但他知道可以编写这样一个脚本.这是行之有效的方法,但不是特别令人兴奋的方法. 不过,这个问题有点不太一样.您如何能确定在 HTA 中选择了哪些文本?哎呀,我们也

纯asp分离FORM数据中的二进制文件和文本数据

二进制|数据 以下源代码为一个文件 <%''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''作者:playxp,Email:playxp@sohu.com有问题请与我联系'功能:纯asp分离FORM数据中的二进制文件和文本数据(支持中文).'使用方法:将此文件包含在处理form的asp文件中,使用GetValue(name)来读取表单中各个元素的值.'注意:一定不要

在Word 2007中将表格转换为文本

在Word2007文档中,用户可以将Word表格中指定单元格或整张表格转换为文 本内容(前提是Word表格中含有文本内容),操作步骤如下所述: 第1步,打开Word2007文档窗口,选中需要转换为文本的单元格.如果需要将 整张表格转换为文本,则只需单击表格任意单元格.在"表格工具"功能区切换 到"布局"选项卡,然后单击"数据"分组中的"转换为文本"按钮,如图 2009021306所示. 图2009021306 单击"

Word 2007如何将表格转换为文本

  在Word2007文档中,用户可以将Word表格中指定单元格或整张表格转换为文本内容(前提是Word表格中含有文本内容),操作步骤如下所述: 第1步,打开Word2007文档窗口,选中需要转换为文本的单元格.如果需要将整张表格转换为文本,则只需单击表格任意单元格.在"表格工具"功能区切换到"布局"选项卡,然后单击"数据"分组中的"转换为文本"按钮,如图1所示. 图1单击"转换为文本"按钮 第2步,在打开

android-Android pcm转换为文本

问题描述 Android pcm转换为文本 请问,大神些,如何将pcm语音文件中保存的数据,转换为具体的文字??急求解决! 解决方案 参考:http://blog.csdn.net/wangkuifeng0118/article/details/7251813 解决方案二: 这个方法我都试过了,但是手机提示找不到设备,就是没有找到RecognizerIntent.ACTION_RECOGNIZE_SPEECH这个类.我是在真机上面测试的!

php中将html中的br换行符转换为文本输入中的换行符_php技巧

下面这几个方法将能够帮你解决这个问题. PHP版将html中的<br />换行符转换为文本框中的换行符: 复制代码 代码如下: function br2nl($text){    return preg_replace('/<br\\s*?\/??>/i','',$text);} 或者: 复制代码 代码如下: function br2nl($text){    $text=preg_replace('/<br\\s*?\/??>/i',chr(13),$text); r

hta查看磁盘空间的脚本_hta

<html> <head> <title>磁盘空间查看脚本</title> <hta:application      applicationname="磁盘空间查看脚"           border="dialog"      borderstyle="normal"      caption="yes"      contextmenu="no"

hta编写的消费记录程序_hta

将代码复制粘贴到一文本文档中,然后保存,并将该文件后缀名改为:hta,双击即可运行. 复制代码 代码如下: <!--////////程序说明/////////==== 程序名称:消费记录Ver1.1(20070808-20070811).hta 使用说明:将代码复制粘贴到一文本文档中,然后保存,并将该文件后缀名改为:hta,双击即可运行. 作者说明:youxi01,,,版权没有,欢迎盗版!!///////////--> <!--///////设置题头,编码方式//////--> &