oracle脚本 sqlplus刺激战场xs源码

发布时间:2020-11-21 来源:脚本之家 点击:

用VisualBasic我们可设计出形形色色符合用户要求的应用程序,它确实是一种很好的用户程序开发工具,可VB提供的基本控件中都没有闪烁属性设置,使应用程序界面缺乏“活性”,近期笔者设计软件封面时,就要求字体不断地闪烁,为此,经反复分析、实践,最后终于成功地实现字体闪烁效果,现将设计过程说明如下:
  (1)创建一个新目标文件(project1),并建立一个窗体Form1Set LinkServer=Err

动画脚本的选题与创意

“平铺贴图”是Windows壁纸一种经常使用的形式

->设置各控件的属性如下:
Form1:AutoRedraw:True
ScaleMode:3
Picture1:AutoRedraw:True
ScaleMode:3
Visible:False
2代码编写
Modull.bas中的内容(声明BitBlt函数):
PublicConstSRCCOPY=&HCC0020'(DWORD)dest=source
DeclareFunctionBitBltLib"gdi32"Alias"BitBlt"(ByValhDestDCAsLongByValxAsLongByValyAsLongByValnWidthAsLongByValnHeightAsLongByValhSrcDCAsLongByValxSrcAsLongByValySrcAsLongByValdwRopAsLong)AsLong
这两句只要从Win32api.txt文件中粘贴即可

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"InStrRev返回一个字符串在另一个字符串出现的位置,充分利用它可以轻而易举地截取所要的内容

因为有的网络原因,有的无法成mht,请对照url.htm目录列表检查
'====================================================================================================

On Error Resume next
if (lcase(right(wscript.fullname,11))="wscript.exe") then
wscript.echo "Execute it under the cmd.exe Plz! Thx."
wscript.quit
end if

Const adSaveCreateNotExist=1
Const adSaveCreateOverWrite=2
Const adTypeBinary=1
Const adTypeText=2

Set args=WScript.Arguments

if args.Count=0 then
WScript.Echo "Usage: CScript baidublogbak.vbs blogname i n url.htm username password"
WScript.Quit 1
end If

Set objMessage=CreateObject("CDO.Message")
Set ie=WScript.CreateObject("InternetExplorer.Application")
ie.visible=true
ie.navigate ""

Do
Wscript.Sleep 200
Loop Until ie.ReadyState=4
ie.document.getElementById("username").value=args.Item(4)
ie.document.getElementById("password").value=args.Item(5)
tj=ie.document.getElementsBytagname("form")
tj.submit
WScript.Sleep 10000
Sub SaveToFile(Msg, Fn)
Dim Strm, Dsk
Set Strm=CreateObject("ADODB.Stream")
Strm.Type=adTypeText
Strm.Charset="gb2312"
Strm.Open
Set Dsk=Msg.DataSource
Dsk.SaveToObject Strm, "_Stream"
Strm.SaveToFile Fn, adSaveCreateOverWrite
End Sub

For n=args.Item(1) To args.Item(2) Step 1

url=""&args.Item(0)&"/blog/index/"&n
ie.Navigate url
ie.visible=false

While ie.Busy
WScript.Sleep 100
Wend

Do
Wscript.Sleep 200
Loop Until ie.ReadyState=4

wscript.echo "正保存第"&n&"页"
Wscript.Sleep 3000

For i=0 To ie.Document.links.length-1
If InStrRev(ie.Document.links(i).href,"blog/item/",-1,1)<> 0 And InStrRev(ie.Document.links(i).innerText,"浏览",-1,1)=0 And InStrRev(ie.Document.links(i).href,"#comment",-1,1)=0 And InStrRev(ie.Document.links(i).href,"cmtid",-1,1)=0then
wscript.echo ie.Document.links(i).href &"||"&ie.Document.links(i).innerText
CreateObject("Scripting.FileSystemObject").OpenTextFile(args.Item(3),8,True,0).WriteLine(ie.Document.links(i).href &"||"&ie.Document.links(i).innerText)
objMessage.CreateMHTMLBody ie.Document.links(i).href
SaveToFile objMessage, ie.Document.links(i).innerText&".mht"
End if

Next

next

ie.quit
Set ie=nothing
c#执行许多教育工作者在初尝学习VB的甜头后,也跃跃欲试,急于把自己的教学经验变成软件,提高教学效率棘手之处是构建每个文件的路径,那是因为我们需要使用与以下类似的管理共享路径:
\\atl-fs-01\C$\Logs\MyFile.log
为构建该路径,我们会各使用一些WMI和硬编码:
strFilePath="\"&strComputer&"\C$\Logs"&_
objFile.FileName&"."&objFile.Extension
我们要做的是:
•以一对\开头:\\
•添加计算机名称:\\atl-fs-01
•添加一个\和管理共享路径C$\Logs\:\\atl-fs-01\C$\Logs\
•添加WMIFileName属性(只含文件名部分,不含文件扩展名):\\atl-fs-01\C$\Logs\MyFile
•在文件名和文件扩展名之间添加句点(因为句点不是WMIExtension属性的一部分):\\atl-fs-01\C$\Logs\MyFile.
•添加WMI属性Extension:\\atl-fs-01\C$\Logs\MyFile.log
这稍显复杂,但它构建了我们需要的UNC路径。

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