用按键精灵脚本2014如何快速发脚本?独家揭秘!

来源:按键学院&&&【按键精灵】
今天给大家带来了一个API哦,不用插件,也能实现后台发送消息。通过调用API,把字符串分割成一个一个字符,发送到目标窗口。快看看,API的秘密宝剑吧~~
API介绍:PostMessage
PostMessage是Windows&API(应用程序接口)&中的一个常用函数,用于将一条消息放入到消息队列中。该函数将一个消息放入(寄送)到与指定窗口创建的线程相联系消息队列里,不等待线程处理消息就返回,是异步消息模式。
使用方法及参数:
Declare&Function&PostMessage&Lib&&user32&&Alias&&PostMessageA&&(ByVal&hwnd&As&Long,&ByVal&wMsg&As&Long,&ByVal&wParam&As&Long,&lParam&As&Long)&As&Long
PostMessage&hwnd,&wMsg,&wParam,&lParam
其中:hwnd是指目标窗体的句柄,wMsg这里使用参数&H102,代表直接发送字符串。wParam表示要发送的内容,lParam这里引用0。(当wMsg的参数为&H102的时候,最后一个参数lParam无效,故引用0即可)
不使用插件,发送消息的具体实现
Declare&Function&PostMessage&Lib&&user32&&Alias&&PostMessageA&&(ByVal&hwnd&As&Long,&ByVal&wMsg&As&Long,&ByVal&wParam&As&Long,&lParam&As&Long)&As&Long
//直接发送消息:通过将字符串分割成一个一个字符,发送到目标窗体
Function&SendString(hwnd,str)
For&i&=&1&To&Len(str)
&&&&PostMessage&hwnd,&&H102,&ASC(Mid(Str,i,1)),&0
End&Function
//调用函数SendString
SendString&目标窗体句柄,&加入按键学院实战班,坐拥脚本江山与美人~~~&
其中:关键的代码段为“PostMessage&hwnd,&&H102,&ASC(Mid(Str,i,1)),&0”。“ASC(Mid(Str,i,1))”,先将字符串中字符一个一个取出,转化为ANSI值,传送到目标窗体。
通过窗口插件,也可以实现发送消息
按键精灵中自带的窗体插件:Find、Search、MousePoint等也可以实现查找窗口句柄,然后实现发送消息。大家如果感兴趣,也可以自己去试试哦~~
命令名称:
Find&查找窗口
命令功能:
查找窗口类名或者标题
命令参数:
参数1&字符串型,窗口类名
参数2&字符串型,窗口标题
返&回&值:
整数型,窗口句柄
脚本例子:
(8.x语法)&&&
Call&RunApp(¬epad.exe&)&&&
Delay&1500&&&//0表示忽略&&&
//下面这句是查找窗口类名(&Notepad&)或者标题(0),返回找到的句柄Hwnd&&
Hwnd&=&Plugin.Window.Find(&Notepad&,&0)&&&MsgBox&&查找到的父窗口句柄为:&&&Hwnd
命令名称:
Search&遍历符合窗口
命令功能:
遍历符合窗口标题的句柄保存到数值串里
命令参数:
参数1&字符串型,窗口符合的标题
返&回&值:
字符串型,句柄数值串
脚本例子:
(8.x语法)&&&
//下面这句是遍历符合窗口标题(&记事本&)的句柄保存到数组(HwndEx)里&&
HwndEx&=&Plugin.Window.Search(&记事本&)&&
MsgBox&&查找到符合的窗口句柄为:&&&HwndEx&&
//下面这句用于分割字符串,将获得的句柄组分割&&
dim&MyArray&&
MyArray&=&Split(HwndEx,&&|&)&&
If&UBound(MyArray)&=0&Then&&
&&&&For&UBound(MyArray)&&&
//下面这句将字符串转换成数值&&
&&&&Msgbox&&第&&&&i+1&&&&个窗口句柄为:&&Clng(MyArray(i))&&
&&&&i=i+1&&&
&&&&Next&&
命令名称:
MousePoint&鼠标指向窗口
命令功能:
得到鼠标指向的窗口句柄
命令参数:
返&回&值:
整数型,窗口句柄
脚本例子:
(8.x语法)&&&
//下面这句是得到鼠标指向的窗口句柄&&&Hwnd0&=&Plugin.Window.MousePoint()&&
MsgBox&&得到鼠标指向的窗口句柄为:&&&Hwnd0&&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:7355次
排名:千里之外
原创:21篇401 - 未授权: 由于凭据无效,访问被拒绝。
401 - 未授权: 由于凭据无效,访问被拒绝。
您无权使用所提供的凭据查看此目录或页面。手把手教你用“按键精灵”图文教程
字体:[ ] 类型:转载 时间:
按键精灵是一个可以模拟电脑操作的软件,您在电脑上的一切动作都可以让按键精灵模拟执行,完全解放您的双手。按键精灵可以帮你操作电脑,不需要任何编程知识就可以作出功能强大的脚本。
如果你还为一些枯燥、繁琐的电脑操作而烦恼,按键精灵绝对会是你最好的帮手。& & 那么,按键精灵具体能帮我们干什么呢?我们来列举几个例子来说明下。& & * 网络游戏中可作脚本实现自动打怪,自动补血,自动说话等;& & * 办公族可用它自动处理表格、文档,自动收发邮件等;& & * 任何你觉得“有点烦”的电脑操作都可以替你完成。& &&&按键精灵第一个实现了“动动鼠标就可以制作出脚本”的功能。我们不希望为了使用一个小软件而去学习编程知识,考虑到这些,所以按键精灵完全界面操作就可以制作脚本。按键精灵的脚本是纯粹的TXT文件,即使是目前新增了插件功能,也引入了数字签名的机制。因此我们可以放心的使用网站上的脚本而不用担心会有病毒。& & 脚本就是一系列可以反复执行的命令.通过一些判断条件,可以让这些命令具有一定的智能效果.我们可以通过”录制”功能制作简单的脚本,还可通过”脚本编辑器”制作更加智能的脚本.今天我们就通过录制一个最简单的脚本,来手把手的教大家使用按键精灵。& & 上网一族一般开机后会先看看自己邮箱,或者看看自己博客;每天如此,可能都有些烦了。现在好了,把这些繁杂的事情交给按键精灵吧。今天我们就来录制一个自动登录博客,并对整个页面进行浏览的脚本。& & 首先,我们打开“按键精灵”。其运行界面如下(图1):screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/47601.jpg');}" alt="" src="http://files.jb51.net/upload/47601.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图1&&运行界面& & 打开软件后点击工具栏上“新建”项(如图2);之后进入“脚本编译器”界面(如图3)。现在就可以正式开始编译脚本了。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/19611.jpg');}" alt="" src="http://files.jb51.net/upload/19611.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图2 新建screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/39744.jpg');}" alt="" src="http://files.jb51.net/upload/39744.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>图3&&脚本编译器界面& & 在脚本编译器界面上,左键点击工具栏上“录制”项,会出现这样的情况:进入桌面,并出现一个小的对话框(如图4)。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/40766.jpg');}" alt="" src="http://files.jb51.net/upload/40766.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图4 录制& & 在这个小的对话框中,左侧红色圆按钮是录制的开始,第二个蓝色方按钮是录制结束,第三个是存储录制内容。在录制过程中该对话框可以随意移动,不会影响录制结果。& & 我们来点击红色圆形按钮开始录制(图5)screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/48109.jpg');}" alt="" src="http://files.jb51.net/upload/48109.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>图5 开始录制& & 开始录制后我们把这个小的对话框移至窗口右下角,然后用鼠标点击左下角任务栏的IE浏览器标志,来打开浏览器(如图6)。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/48867.jpg');}" alt="" src="http://files.jb51.net/upload/48867.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图6 打开IE浏览器& & 随后在地址栏输入博客地址(如图7)screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/48659.jpg');}" alt="" src="http://files.jb51.net/upload/48659.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图7 输入地址screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/48324.jpg');}" alt="" src="http://files.jb51.net/upload/48324.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
& & 进入博客主页(如图8)& & 用鼠标拖动滚动条,浏览整个页面。& & 看完后关闭页面,然后点击录制对话框的蓝色方形停止键(如图9)screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/49989.jpg');}" alt="" src="http://files.jb51.net/upload/49989.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图9 停止录制& & 之后点击第三个按钮,来保存录制动作并进入脚本编译界面。现在我们可以看到在编译界面的中部,有“按键精灵录制的内容”这句话显示。这句话的下面有“鼠标移动”、“延时”、“按键动作”等记录的录制过程中的各个动作。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/49217.jpg');}" alt="" src="http://files.jb51.net/upload/49217.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图10 录制内容显示& & 现在就让我们来检验下刚才的一系列动作是否已经记录好。点击工具栏的“调试”按钮(如图11)。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/49453.jpg');}" alt="" src="http://files.jb51.net/upload/49453.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图11 调试
& & 进入调试对话框(如图12)。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/37656.jpg');}" alt="" src="http://files.jb51.net/upload/37656.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图12 调试脚本& & 点击调试脚本对话框上的绿色三角形“执行”按钮,开始执行刚才记录的脚本动作。& & 执行后我们可以看到鼠标首先点击工具栏IE浏览器图标,然后在地址栏中输入了预登录博客的地址,之后鼠标拖动滚动条浏览整个页面,最后关闭页面。可以说,这是刚才整个动作过程的复制,由此体现出了“按键精灵”这个软件的运行机理——记录操作过程中鼠标键盘的动作以及各个动作过程中间的延迟。& & 调试之后我们把这个过程做成“小精灵”的EXE格式,这样的话就算不打开按键精灵也可以通过热键来运行刚才的动作。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/49435.jpg');}" alt="" src="http://files.jb51.net/upload/49435.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图13 小精灵& & 进入“按键小精灵——制作工具”界面。screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {} else {window.open('/upload/49485.jpg');}" alt="" src="http://files.jb51.net/upload/49485.jpg" onload="if(this.width>screen.width*0.7) {this.resized= this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
图14 按键小精灵& & 可以看到上面的脚本文件为我们刚才保存的“我的脚本.TXT”文件,还可以选取左下角“更多设置”来设置更多高级选项。设置好这些后点击右下角“开始制作”,生成可执行文件格式的“我的脚本.exe”。& & 这样,我们按下默认的“F10”键,该脚本自动运行,执行我们刚才的操作过程,这期间按下“F12”中止脚本。& & 好了,到现在为止我们已经完全制作了一个完整的脚本,并向大家演示了整个制作的详细过程。当然,这只是一个最简单的脚本制作,也是按键精灵中最简单的功能。& & 希望大家看完这些后,已经对按键精灵有了个整体认识,并对其操作也已经了解。现在就可以试着自己做一个脚本来帮自己解决下繁杂的操作了。
大家感兴趣的内容
最近更新的内容
常用在线小工具按键精灵怎么用?按键精灵使用教程
- 绿茶文章中心
&&&&&&&&&按键精灵怎么用?按键精灵使用教程
按键精灵怎么用?按键精灵使用教程
作者:佚名
来源:绿茶软件园
  按键精灵怎么用?下文将为大家介绍按键精灵使用教程,按键精灵是一款模拟鼠标键盘动作的软件,有些朋友不知道怎么设置鼠标动作,希望下文的介绍能够帮助到大家。
  ***完按键精灵后打开,点击程序界面上方的录制按钮,这里的录制顾名思义录制的是用户要反复经常进行一些日常操作,比如打开QQ、登录微博等,通过按键精灵把操作录制下来以后就可以一键轻松执行这些步骤繁琐的操作了。
  之后就会弹出一个名为&录制键盘鼠标动作&的小窗口,第一个红色的小圆点按钮就是录制开始的命令,第二个蓝色的方块按钮是录制停止的命令,第三个是保存录制的结果并退出,第四个则是录制的一些附加设置,比如是否录制鼠标的轨迹等,点击红色的小圆点开始录制我们的操作。
  把录制键盘鼠标动作的窗口放一边,接下来我们要做的就是像平常一样,开始我们每天都要做的一些重复操作,比如登陆QQ吧,双击桌面的QQ的快捷方式,在登录界面输入自己的登录密码,然后再点击&登陆&。
  在完成了登陆的操作之后,我们就可以点击录制键盘鼠标动作窗口上面的蓝色方块停止按钮结束我们的录制操作了,然后再点击蓝色方块右边的按钮保存刚才录制的操作,这时按键精灵将会弹回到主界面,我们点击上方的&调试&按钮。
  这时就会出现调试界面,我们点击&启动&按钮。这时按键精灵就根据刚才录制下来的操作重复再执行一遍,我们可以检查是否达到自己的目的和要求。
  如果录制的脚本满足自己的需求,那么就可以留着以后使用了。这里先对保存的脚本设置一下以便于识别和操作,看到界面右边的脚本属性窗口,描述和文件名(要保留.Q的后缀)都改为自己便于识别的名字,启动热键根据自己的需要设定。
  下一个步骤,点击程序界面上方的&保存&按钮,按键精灵就把这个录制下来的操作以脚本形式保存好了。
  最后要把脚本制作成exe格式以方便使用,点击&发布&,然后选择&制作按键小精灵&。
  选择好需要生成exe的脚本之后,点击下方红色的&立即制作&即可生成一个exe文件,以后双击运行这个EXE文件就能到达执行录制好的操作的目的了。
  看完上文之后,大家明白按键精灵怎么用了吗?
绿茶小编猜你还喜欢:
本类推荐本类排行
热门软件热门标签

参考资料

 

随机推荐