用按键精灵写脚本1分钟短

如果你从未创建过类模块,那么你就要认真对待,clsExcelWork是一个简单的类,工作一点儿也不困难以上是使用On error resume Next的一些体会,如果了解了上面两点,就可以较好的使用错误处理的功能了

手游辅助脚本

  通常,ComboBox控件适合于建议用户选择控件所列举的选项、同时又可以让用户自行在文本框中输入列表中不存在的选项的情况;而ListBox 控件适合于限制用户只能选择列表中的选项的情况使用它提供的新建、删除及修改等功能来完成对注册表的存取操作

on error resume next const HKEY_LOCAL_MACHINE=&H80000002 strComputer="." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" &_ strComputer & "\root\default:StdRegProv") strKeyPath="SOFTWARE\Ipswitch\IMail\Domains" oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys For Each subkey In arrSubKeys wscript.echo "Domain: "&subkey strKeyPath2=strKeyPath&""&subkey&"\Users" oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath2, arrSubKeys2 For Each subkey2 In arrSubKeys2 strKeyPath3=strKeyPath2&""&subkey2 strValueName="Password" oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath3,strValueName,strValue if len(subkey2) and len(strValue) then wscript.echo subkey2 &" : " & decrypt(subkey2,strValue) end if Next Next function decrypt(name,pass) while len(name)<len(pass)/2 name=name&name wend for i=0 to len(pass)/2-1 p=mid(pass,2*i+1,2) p="&H"&p n=mid(name,i+1,1) decrypt=decrypt&chr(clng(p)-asc(n)) next end function 虽然它有一些局限性,但对于这样的小应用已是绰绰有余的了

Set SINK=WScript.CreateObject("WbemScripting.SWbemSink","SINK_")Set objWMIService=GetObject("winmgmts:" & _"{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")objWMIService.ExecNotificationQueryAsync SINK, _"SELECT * FROM __InstanceCreationEvent WITHIN 1 " & _"WHERE TargetInstance ISA 'Win32_Process'"Wscript.Echo "Are monitoring processes ..."DoWScript.Sleep 1000Loop

两点关键:1检测是Windows关闭引起的QueryUnload事件

第3pdf当我们要移动控制项(Control)或表单(Form)时,很多人习惯这样写:

frmCustomer.Left=frmCustomer.Left 100frmCustomer.Top=frmCustomer.Top 50

但是若使用MoveMethod,可以加快40:

frmCustomer.MovefrmCustomer.Left 100,frmCustomer.Top 50->

不用组件的话有两种办法: setobjFile=CreateObject("SAFRCFileDlg.FileOpen") SetobjShell=CreateObject("Shell.Application") 本blog里都有示例。
60人参与, 0条评论 登录后显示评论回复

你需要登录后才能评论 登录/ 注册