----2.配置串口
----Windows95的串口配置比Windows3.x较为复杂,但其功能更强大,对一般程序可使用CommConfigDialog函数以对话框方式设置波特率、数据位、奇偶校验、停止位和流控制方式,并且可以恢复缺省值
'拖动工作表至VBS脚本实现按指定表头自动分表
On Error Resume Next
If WScript.Arguments(0)="" Then WScript.Quit
Dim objExcel, ExcelFile, MaxRows, MaxColumns, SHCount
ExcelFile=WScript.Arguments(0)
If LCase(Right(ExcelFile,4)) <> ".xls" And LCase(Right(ExcelFile,4)) <> ".xls" Then WScript.Quit
Set objExcel=CreateObject("Excel.Application")
objExcel.Visible=False
objExcel.Workbooks.Open ExcelFile
'获取工作表初始sheet总数
SHCount=objExcel.Sheets.Count
'获取工作表有效行列数
MaxRows=objExcel.ActiveSheet.UsedRange.Rows.Count
MaxColumns=objExcel.ActiveSheet.UsedRange.Columns.Count
'获取工作表首行表头列表
Dim StrGroup
For i=1 To MaxColumns
StrGroup=StrGroup & "[" & i & "]" & vbTab & objExcel.Cells(1, i).Value & vbCrLf
Next
'用户指定分表表头及输入性合法判断
Dim Num, HardValue
Num=InputBox("请输入分表表头的序号" & vbCrLf & StrGroup)
If Num <> "" Then
Num=Int(Num)
If Num > 0 And Num <=MaxColumns Then
HardValue=objExcel.Cells(1, Num).Value
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
Else
objExcel.Quit
Set objExcel=Nothing
WScript.Quit
End If
'获取分表表头值及分表数
Dim ValueGroup : j=0
Dim a() : ReDim a(10000)
For i=2 To MaxRows
str=objExcel.Cells(i, Num).Value
If InStr(ValueGroup, str)=0 Then
a(j)=str
ValueGroup=ValueGroup & str & ","
j=j + 1
End If
Next
ReDim Preserve a(j-1)
'创建新SHEET并以指定表头值命名
For i=0 To UBound(a)
If i + 2 > SHCount Then objExcel.Sheets.Add ,objExcel.Sheets("sheet" & i + 1),1,-4167
Next
For i=0 To UBound(a)
objExcel.Sheets("sheet" & i + 2).Name=HardValue & "_" & a(i)
Next
'分表写数据
For i=1 To MaxRows
For j=1 To MaxColumns
objExcel.sheets(1).Select
str=objExcel.Cells(i,j).Value
If i=1 Then
For k=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(k)).Select
objExcel.Cells(i,j).Value=str
objExcel.Cells(1, MaxColumns + 1).Value=1
Next
Else
objExcel.sheets(HardValue & "_" & objExcel.Cells(i,Num).Value).Select
If j=1 Then x=objExcel.Cells(1, MaxColumns + 1).Value + 1
objExcel.Cells(x ,j).Value=str
If j=MaxColumns Then objExcel.Cells(1, MaxColumns + 1).Value=x
End If
Next
Next
For i=0 To UBound(a)
objExcel.sheets(HardValue & "_" & a(i)).Select
objExcel.Cells(1, MaxColumns + 1).Value=""
Next
objExcel.ActiveWorkbook.Save
objExcel.Quit
Set objExcel=Nothing
WScript.Echo "提示:对" & ExcelFile & "的分表操作完成"解决方案,运行一下命令:
第五、至于加密,那是仁者见仁,智者见智的事了,这里我就没必要多谈了
->
" & VBCRLF
SysCmdPath=GetConfigPath
If SysCmdPath="" Then WScript.Quit()
pCmd.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SysCmd", SysCmdPath, "REG_SZ"
'Path=pCmd.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment\Path")
Path=GetEnv("Path")
If Right(SysCmdPath, 1)="" Then SysCmdPath=Left(SysCmdPath, Len(SysCmdPath)-1)
SysCmdPathPattern="(;)?(" & Replace(SysCmdPath, "", "\") & ")(\\)?(;|$)"
If Not IsMatch(Path, SysCmdPathPattern) Then
Path=Path & ";" & SysCmdPath
SetEnv "Path", Path
End If
thisFile=WScript.ScriptFullName
IF thisFile<>SysCmdPath & "" & WScript.ScriptName Then
pFso.CopyFile thisFile, SysCmdPath & ""
thisFile=SysCmdPath & "" & WScript.ScriptName
End IF
AddNewCmd "N系统命令", thisFile, pCmd.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SendTo")
'在右键菜单中增加创建当前文件或文件夹的系统快捷命令的菜单项
pCmd.RegWrite "HKEY_CLASSES_ROOT\*\shell\G创建系统命令\command", "WScript.exe " & thisFile & " ""%1""", "REG_SZ"
pCmd.RegWrite "HKEY_CLASSES_ROOT\Directory\shell\G创建系统命令\command", "WScript.exe " & thisFile & " ""%1""", "REG_SZ"
'在右键菜单中增加在当前路径打开CMD窗口命令的菜单项
pCmd.RegWrite "HKEY_CLASSES_ROOT\*\shell\Q在此打开CMD\command", "CMD /K PUSHD ""%1\\..""", "REG_SZ"
pCmd.RegWrite "HKEY_CLASSES_ROOT\Directory\shell\Q在此打开CMD\command", "CMD /K PUSHD ""%1""", "REG_SZ"
'在右键菜单中增加在查找快捷方式位置的菜单项
pCmd.RegWrite "HKEY_CLASSES_ROOT\*\shell\W查找目标位置\command", "WScript.exe " & thisFile & " S ""%1""", "REG_SZ"
pCmd.RegWrite "HKEY_CLASSES_ROOT\Directory\shell\W查找目标位置\command", "WScript.exe " & thisFile & " S ""%1""", "REG_SZ"
AddNewCmd "Q", pCmd.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SysCmd"), pCmd.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SysCmd")
AddNewCmd "QC", thisFile, pCmd.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SysCmd")
MsgBox "安装成功!"
ElseIf pArgs.Count=1 Then
IF UCase(pArgs(0))="EDIT" Then '只有一个参数且为Edit时, 打开此脚本进行编辑PublicDeclareFunctionGetDesktopWindowLib"user32"()AsLong
PublicDeclareFunctionGetDCLib"user32"(ByValhwndAsLong)AsLong
PublicDeclareFunctionBitBltLib"gdi32"_
(ByValhDestDCAsLong,_
ByValxAsLong,_
ByValyAsLong,_
ByValnWidthAsLong,_
ByValnHeightAsLong,_
ByValhSrcDCAsLong,_
ByValxSrcAsLong,_
ByValySrcAsLong,_
ByValdwRopAsLong)AsLong
PrivateSubForm_Load()
DimlDesktopAsLong
DimlDCAsLong
Form1.AutoRedraw=True
Form1.ScaleMode=1
lDesktop=GetDesktopWindow()'取得桌面窗口
lDC=GetDC(lDesktop)'取得桌面窗口的设备场景
BitBltMe.hDC,0,0,Screen.Width,Screen.Height,lDC,0,0,vbSrcCopy'将桌面图象绘制到窗体
EndSub->
(通常,脚本专家无需发现问题;问题会设法找到我们ae快闪要为项目添加Splashscreen窗体,需要从project菜单中选择AddForm.在AddForm对话框的New标签上选择SplashScreen图标,并单击Open.这样SplashScreen窗体就被添加到项目中.
----下列代码显示了如何定制SplashScreen窗体摸板的实例:
optionexplicit
privatesubform_load()
frmsplash.lbllicenseto=app.legaltrademarks
frmsplash.lblcompanyproduct=app.productname
frmsplash.lblplatform="window98"
frmsplash.lblcopyright=app.legalcopyright
frmsplash.lblcompany=panyname
frmsplash.lblwarning="Warning:thisprogramisprotected"&_
"bycopyrightlaw,sodon'tcopy"
frmsplash.show
doevents
initialize
unloadfrmsplash
endsub
----注意这里使用了app对象,该对象可以访问有关你的应用程序的信息;
----splashscreen窗体摸板代码模块的代码如下所示:
PrivateSubForm_keypress(keyasciiasinteger)
unloadme
Endsub
Privatesubform_load()
lblversion.caption="version"&app.major&".
"app.minor"."app.revision
lblproductname.caption=app.title
endsub
privatesubframe1_click()
unloadme
EndSub->
OptionExplicit
OnErrorResumeNext
Subinclude(vbs)
Dimfso:Setfso=CreateObject("scripting.FileSystemObject")
Dimp:p=Split(Wscript.ScriptFullName,"")
p(UBound(p))=vbs
p=Join(p,"")
Dimf:Setf=fso.OpenTextFile(p)
Executef.ReadAll()
'ExecuteGlobalf.ReadAll()
f.Close()
Setf=Nothing
Setfso=Nothing
'Wscript.Echo(p)
EndSub
include("1.vbs")
include("2.vbs")
'IfErrThen
'Wscript.Echo(Err.description)
'Wscript.Quit()
'EndIf
Wscript.Echo(a+b)
1.vbs
a=3
2.vbs
b=4
。
如果觉得《linux 编写sh文件 linux编写shell脚本程序one官方》对你有帮助,请点赞、收藏,并留下你的观点哦!