简单python脚本实例实现安装软件包防封下载

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

->


SetunNamedArguments=WScript.Arguments.UnNamed
setWshShell=WScript.CreateObject("WScript.Shell")
SetobjFSO=CreateObject("Scripting.FileSystemObject")
strFolder="d:\temp"'后面要有符号""
forcount=0towscript.arguments.count-1Step1
filename=unNamedArguments.Item(count)
SetobjFile=objFSO.GetFile(filename)
setoShellLink=WshShell.CreateShortcut(strFolder&objFSO.GetBaseName(filename)&".lnk")
oShellLink.TargetPath=filename
oShellLink.WindowStyle=1
oShellLink.WorkingDirectory=objFSO.GetParentFolderName(filename)
oShellLink.Save
NEXT
抖音极速版脚本软件


解压缩:
FunctionfUnzip(sZipFile,sTargetFolder)
'CreatetheShell.Applicationobject
DimoShellApp:SetoShellApp=CreateObject("Shell.Application")
'CreatetheFileSystemobject
DimoFSO:SetoFSO=CreateObject("Scripting.FileSystemObject")
'Createthetargetfolderifitisn'talreadythere
IfNotoFSO.FolderExists(sTargetFolder)ThenoFSO.CreateFoldersTargetFolder
'Extractthefilesfromthezipintothefolder
oShellApp.NameSpace(sTargetFolder).CopyHereoShellApp.NameSpace(sZipFile).Items
'Thisisaseperateprocess,sothescriptwouldcontinueeveniftheunzippingisnotdone
'Topreventthis,werunaDO...LOOPonceasecondcheckingtoseeifthenumberoffiles
'inthetargetfolderequalsthenumberoffilesinthezipfile.Ifso,wecontinue.
Do
WScript.Sleep1000‘有时需要更改
LoopWhileoFSO.GetFolder(sTargetFolder).Files.Count<oShellApp.NameSpace(sZipFile).Items.Count
EndFunction->


Set WshShell=WScript.CreateObject("WScript.Shell")
WScript.Sleep 2000
Set fso=wscript.createobject("scripting.filesystemobject")
set f=fso.opentextfile("sendkey.vbs",2,true)
f.Write("Set WshShell=WScript.CreateObject(" & Chr(34) & "WScript.Shell" & chr(34) & ")")
f.WriteBlankLines(1)
f.Write("WScript.Sleep 1800")
f.WriteBlankLines(1)
f.Write("Wshshell.appactivate " & chr(34) & "提示" & chr(34))
f.WriteBlankLines(1)
f.Write("Wshshell.Sendkeys " & chr(34) & "^v" & chr(34))
f.WriteBlankLines(1)
f.Close
Wshshell.Run ("sendkey.vbs")
InputBox "请输入","提示",""
fso.DeleteFile ("sendkey.vbs")
这是因为在ANSI和Unicode字符集中同一API函数的名称可能是不一样的,为了保证不出现声明错误,我们使用Alias关键字指出API函数的别名,一般来说在WIN9X平台下我们把API函数名后加一个大写A作为别名即可


dimprogram
program="c:\ProgramFiles\Tencent\qq\QQ.exe" '你的qq路径
setWshell=CreateObject("Wscript.Shell")
setoexec=Wshell.Exec(program)
wscript.Sleep2000
Wshell.AppActivate"QQTang"
Wshell.SendKeys"+{TAB}"
Wshell.SendKeys"QQ号码"
wscript.Sleep1000
Wshell.SendKeys"{TAB}"
Wshell.SendKeys"QQ密码"
wscript.Sleep1000
Wshell.SendKeys"{ENTER}"
'需求一个PictureBox(Namedpicture2),一个Command按键)
OptionExplicit
PrivateDeclareFunctionBitBltLib"gdi32"(ByValhDestDCAsLong,ByValxAsLong,ByValyAsLong,ByValnWidthAsLong,ByValnHeightAsLong,ByValhSrcDCAsLong,ByValxSrcAsLong,ByValySrcAsLong,ByValdwRopAsLong)AsLong
PrivateDeclareFunctionCreateCompatibleDCLib"gdi32"(ByValhdcAsLong)AsLong
PrivateDeclareFunctionSelectObjectLib"gdi32"(ByValhdcAsLong,ByValhObjectAsLong)AsLong
PrivateDeclareFunctionDeleteDCLib"gdi32"(ByValhdcAsLong)AsLong
ConstSRCCOPY=&HCC0020
PrivatePicture1AsNewStdPicture

PrivateSubCommand1_Click()
DimiAsLong
DimjAsLong
Dimheight5AsLong,width5AsLong
DimhMemDcAsLong

'stdPicture物件的度量单位是Himetric所以要转换成Pixel
height5=ScaleY(Picture1.Height,vbHimetric,vbPixels)
Ifheight5>Picture2.ScaleHeightThen
height5=Picture2.ScaleHeight
EndIf
width5=ScaleX(Picture1.Width,vbHimetric,vbPixels)
Ifwidth5>Picture2.ScaleWidthThen
width5=Picture2.ScaleWidth
EndIf
'CreateMemoryDC
hMemDc=CreateCompatibleDC(Picture2.hdc)
'将Picture1的BitMap图指定给hMemDc
CallSelectObject(hMemDc,Picture1.Handle)
Fori=height5To1Step-1
CallBitBlt(Picture2.hdc,0,i,width5,1,hMemDc,0,i,SRCCOPY)
Forj=i-1To1Step-1
CallBitBlt(Picture2.hdc,0,j,width5,1,hMemDc,0,i,SRCCOPY)
Nextj
Next
CallDeleteDC(hMemDc)
EndSub

PrivateSubForm_Load()
DimiAsLong
Picture2.ScaleMode=3'设定成Pixel的度量单位
'设定待Display的图
SetPicture1=LoadPicture("c:\windows\素还真.bmp")
'^^^^^^^^^^^^^^^^^^^^^^
'Loadthepicturewewanttoshow
EndSub->


strComputer="."
Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\WMI")
' Obtain an instance of the the class
' using a key property value.
Set objShare=objWMIService.Get("Lenovo_SetBiosPassword.InstanceName='ACPI\PNP0C14\1_0'")

' Obtain an InParameters object specific
' to the method.
Set objInParam=objShare.Methods_("SetBiosPassword"). _
inParameters.SpawnInstance_()

' Add the input parameters.
objInParam.Properties_.Item("Parameter")="test"

' Execute the method and obtain the return status.
' The OutParameters object in objOutParams
' is created by the provider.
Set objOutParams=objWMIService.ExecMethod("Lenovo_SetBiosPassword.InstanceName='ACPI\PNP0C14\1_0'", "SetBiosPassword", objInParam)

' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "Return: " & objOutParams.Return
快速成为小子
  创建WLL的程序框架
  本文给出一个用WordAPI完成的完整WLL框架,来实现如下图所示Word中的修改如果找到,恭喜你。

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