关于按键精灵代码
调试脚本时出现如下问题:您的脚本存在下列错误,将不能正常运行:语法错误:第28行,第1个字符:没有找到合法的符号。错误附加码=0脚本如下:Hwnd=Plugin.Wind...
调试脚本时出现如下问题:
您的脚本存在下列错误,将不能正常运行:
语法错误:第28行,第1个字符:没有找到合法的符号。错误附加码=0
脚本如下:
Hwnd = Plugin.Window.Find(0, "Element Client")
sRect = Plugin.Window.GetClientRect(Hwnd)
Dim MyArray
MyArray=Split(sRect,"|")
Ux=CLng(MyArray(0))
Uy=CLng(MyArray(1))
Rem xuanze
Call chiyao
Call add_mp
KeyPress "F3", 1
Delay 1000
KeyPress "Tab", 1
Delay 1000
IfColor 297+Ux,42+Uy,"3149FF",2 Then
Rem gongji
Call chiyao
KeyPress "F4", 1
Delay 1000
IfColor 236,42,"2945FF",2 Then
Goto gongji
Else
Goto xuanze
End If
Sub chiyao
IfColor 141,42,"291C10",2 Then
KeyPress "F1", 1
Else
End If
End Sub
//定义一个过程,可以在脚本中调用这个过程
Sub add_mp
IfColor 139,52,"393021",2 Then
KeyPress "F2", 1
Else
End If
End Sub
新接触按键代码,请大家帮助。
看了yinlei1990 的回答 ,我用的是按键精灵8.0版本,这个版本里和之前的命令有一些差别,子程序调用可以是以下格式:
//支持Exit Sub 命令退出子程序过程
Call 子程序()
EndScript
Sub 子程序()
Msgbox "我是子程序,被你调用了"
End Sub
//定义一个过程,可以在脚本中调用这个过程
也可以是这位朋友说的这样:
Gosub 子程序
EndScript
Sub 子程序
Msgbox "我是子程序,被你调用了"
Return 子程序
//定义一个过程,可以在脚本中调用这个过程
Gosub 子程序
EndScript
Sub 子程序
Msgbox "我是子程序,被你调用了"
Return 子程序
//定义一个过程,可以在脚本中调用这个过程
子程序语法没有问题 另外一个按TAB的代码 KeyPress "Tab", 1或 KeyPress 9,1在按键8.0里都是支持的,又看了几遍代码 没看出来问题 干脆把28条后删了 但还是一样有28条的报错 鄙视下百度 传一个图片都总是“此网页无法访问”
问题解决了
IfColor 297+Ux,42+Uy,"3149FF",2 Then
Rem gongji
Call chiyao
KeyPress "F4", 1
这段代码不全 加上
Else
End If
就解决了 展开
您的脚本存在下列错误,将不能正常运行:
语法错误:第28行,第1个字符:没有找到合法的符号。错误附加码=0
脚本如下:
Hwnd = Plugin.Window.Find(0, "Element Client")
sRect = Plugin.Window.GetClientRect(Hwnd)
Dim MyArray
MyArray=Split(sRect,"|")
Ux=CLng(MyArray(0))
Uy=CLng(MyArray(1))
Rem xuanze
Call chiyao
Call add_mp
KeyPress "F3", 1
Delay 1000
KeyPress "Tab", 1
Delay 1000
IfColor 297+Ux,42+Uy,"3149FF",2 Then
Rem gongji
Call chiyao
KeyPress "F4", 1
Delay 1000
IfColor 236,42,"2945FF",2 Then
Goto gongji
Else
Goto xuanze
End If
Sub chiyao
IfColor 141,42,"291C10",2 Then
KeyPress "F1", 1
Else
End If
End Sub
//定义一个过程,可以在脚本中调用这个过程
Sub add_mp
IfColor 139,52,"393021",2 Then
KeyPress "F2", 1
Else
End If
End Sub
新接触按键代码,请大家帮助。
看了yinlei1990 的回答 ,我用的是按键精灵8.0版本,这个版本里和之前的命令有一些差别,子程序调用可以是以下格式:
//支持Exit Sub 命令退出子程序过程
Call 子程序()
EndScript
Sub 子程序()
Msgbox "我是子程序,被你调用了"
End Sub
//定义一个过程,可以在脚本中调用这个过程
也可以是这位朋友说的这样:
Gosub 子程序
EndScript
Sub 子程序
Msgbox "我是子程序,被你调用了"
Return 子程序
//定义一个过程,可以在脚本中调用这个过程
Gosub 子程序
EndScript
Sub 子程序
Msgbox "我是子程序,被你调用了"
Return 子程序
//定义一个过程,可以在脚本中调用这个过程
子程序语法没有问题 另外一个按TAB的代码 KeyPress "Tab", 1或 KeyPress 9,1在按键8.0里都是支持的,又看了几遍代码 没看出来问题 干脆把28条后删了 但还是一样有28条的报错 鄙视下百度 传一个图片都总是“此网页无法访问”
问题解决了
IfColor 297+Ux,42+Uy,"3149FF",2 Then
Rem gongji
Call chiyao
KeyPress "F4", 1
这段代码不全 加上
Else
End If
就解决了 展开
展开全部
SUB 是子程序,只能调用,不能直接加在语句里,格式为
SUB XXX
*****子程序内容
Return
调用为GOSUB XXX
例子
Gosub 1
Sub 1
KeyPress 49,1
Delay 500
KeyPress 50,1
Return
子程序可以先写好不管。要用的时候直接Go sub XXX 就行了,在脚本的任意位置都可以。你那个语法是错的。
KeyPress "Tab", 1
还有你这个地方也是错的,按TAB一次应该为 KeyPress 9,1
为了方便你,给你附一张表,其实在按键里直接插入就行,完全不用输入,你自己看吧,对你有用就留着,没用就不管。
VB中的键码常数 键码值 描述
-------------------------------------------------------------------
vbKeyLButton 1 鼠标左键
-------------------------------------------------------------------
vbKeyRButton 2 鼠标右键
-------------------------------------------------------------------
vbKeyCancel 3 CANCEL 键
-------------------------------------------------------------------
vbKeyMButton 4 鼠标中键
-------------------------------------------------------------------
vbKeyBack 8 Backspace 键
-------------------------------------------------------------------
vbKeyTab 9 TAB 键
-------------------------------------------------------------------
vbKeyClear 12 CLEAR 键
-------------------------------------------------------------------
vbKeyReturn 13 Enter 键
-------------------------------------------------------------------
vbKeyShift 16 Shift 键
-------------------------------------------------------------------
vbKeyConterol 17 Ctrl 键
-------------------------------------------------------------------
vbKeyMenu 18 菜单键
-------------------------------------------------------------------
vbKeyPause 19 PAUSE 键
-------------------------------------------------------------------
vbKeyCapital 20 CAPS LOCK 键
-------------------------------------------------------------------
vbKeyEscape 27 ESC 键
-------------------------------------------------------------------
vbKeySpace 32 SPACEBAR 键
-------------------------------------------------------------------
vbKeyPageUp 33 PAGEUP 键
-------------------------------------------------------------------
vbKeyPageDown 34 PAGEDOWN 键
-------------------------------------------------------------------
vbKeyEnd 35 END 键
-------------------------------------------------------------------
vbKeyHome 36 HOME 键
-------------------------------------------------------------------
vbKeyLeft 37 LEFT ARROW 键←
-------------------------------------------------------------------
vbKeyUp 38 UP ARROW 键↑
-------------------------------------------------------------------
vbKeyRight 39 RIGHT ARROW 键→
-------------------------------------------------------------------
vbKeyDown 40 DOWN ARROW 键↓
-------------------------------------------------------------------
vbKeySelect 41 SELECT 键
-------------------------------------------------------------------
vbKeyPrint 42 PRINT SCREEN 键
-------------------------------------------------------------------
vbKeyExecute 43 EXECUTE 键
-------------------------------------------------------------------
vbKeySnapshot 44 SNAP SHOT 键
-------------------------------------------------------------------
vbKeyInser 45 INSERT 键
-------------------------------------------------------------------
vbKeyDelete 46 DELETE 键
-------------------------------------------------------------------
vbKeyHelp 47 HELP 键
-------------------------------------------------------------------
vbKey0 48 0 键
-------------------------------------------------------------------
vbKey1 49 1 键
-------------------------------------------------------------------
vbKey2 50 2 键
-------------------------------------------------------------------
vbKey3 51 3 键
-------------------------------------------------------------------
vbKey4 52 4 键
-------------------------------------------------------------------
vbKey5 53 5 键
-------------------------------------------------------------------
vbKey6 54 6 键
-------------------------------------------------------------------
vbKey7 55 7 键
-------------------------------------------------------------------
vbKey8 56 8 键
-------------------------------------------------------------------
vbKey9 57 9 键
-------------------------------------------------------------------
vbKeyA 65 A 键
-------------------------------------------------------------------
vbKeyB 66 B 键
-------------------------------------------------------------------
vbKeyC 67 C 键
-------------------------------------------------------------------
vbKeyD 68 D 键
-------------------------------------------------------------------
vbKeyE 69 E 键
-------------------------------------------------------------------
vbKeyF 70 F 键
-------------------------------------------------------------------
vbKeyG 71 G 键
-------------------------------------------------------------------
vbKeyH 72 H 键
-------------------------------------------------------------------
vbKeyI 73 I 键
-------------------------------------------------------------------
vbKeyJ 74 J 键
-------------------------------------------------------------------
vbKeyK 75 K 键
-------------------------------------------------------------------
vbKeyL 76 L 键
-------------------------------------------------------------------
vbKeyM 77 M 键
-------------------------------------------------------------------
vbKeyN 78 N 键
-------------------------------------------------------------------
vbKeyO 79 O 键
-------------------------------------------------------------------
vbKeyP 80 P 键
-------------------------------------------------------------------
vbKeyQ 81 Q 键
-------------------------------------------------------------------
vbKeyR 82 R 键
-------------------------------------------------------------------
vbKeyS 83 S 键
-------------------------------------------------------------------
vbKeyT 84 T 键
-------------------------------------------------------------------
vbKeyU 85 U 键
-------------------------------------------------------------------
vbKeyV 86 V 键
-------------------------------------------------------------------
vbKeyW 87 W 键
-------------------------------------------------------------------
vbKeyX 88 X 键
-------------------------------------------------------------------
vbKeyY 89 Y 键
-------------------------------------------------------------------
vbKeyZ 90 Z 键
-------------------------------------------------------------------
vbKeyNum0 96 0 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum1 97 1 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum2 98 2 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum3 99 3 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum4 100 4 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum5 101 5 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum6 102 6 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum7 103 7 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum8 104 8 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum9 105 9 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyMultiply 106 乘号(*) 键
-------------------------------------------------------------------
vbKeyAdd 107 加号(+) 键
-------------------------------------------------------------------
vbKeySeparator 108 Enter键(在数字小键盘上)
-------------------------------------------------------------------
vbKeySubtract 109 减号(-) 键
-------------------------------------------------------------------
vbKeyDecimal 110 小数点(.) 键
-------------------------------------------------------------------
vbKeyDivide 111 除号(/) 键
-------------------------------------------------------------------
vbKeyF1 112 F1 键
-------------------------------------------------------------------
vbKeyF2 113 F2 键
-------------------------------------------------------------------
vbKeyF3 114 F3 键
-------------------------------------------------------------------
vbKeyF4 115 F4 键
-------------------------------------------------------------------
vbKeyF5 116 F5 键
-------------------------------------------------------------------
vbKeyF6 117 F6 键
-------------------------------------------------------------------
vbKeyF7 118 F7 键
-------------------------------------------------------------------
vbKeyF8 119 F8 键
-------------------------------------------------------------------
vbKeyF9 120 F9 键
-------------------------------------------------------------------
vbKeyF10 121 F10 键
-------------------------------------------------------------------
vbKeyF11 122 F11 键
-------------------------------------------------------------------
vbKeyF12 123 F12 键
-------------------------------------------------------------------
vbKeyF13 124 F13 键
-------------------------------------------------------------------
vbKeyF14 125 F14 键
-------------------------------------------------------------------
vbKeyF15 126 F15 键
-------------------------------------------------------------------
vbKeyF16 127 F16 键
-------------------------------------------------------------------
vbKeyNumlock 144 NUM LOCK 键
-------------------------------------------------------------------
SUB XXX
*****子程序内容
Return
调用为GOSUB XXX
例子
Gosub 1
Sub 1
KeyPress 49,1
Delay 500
KeyPress 50,1
Return
子程序可以先写好不管。要用的时候直接Go sub XXX 就行了,在脚本的任意位置都可以。你那个语法是错的。
KeyPress "Tab", 1
还有你这个地方也是错的,按TAB一次应该为 KeyPress 9,1
为了方便你,给你附一张表,其实在按键里直接插入就行,完全不用输入,你自己看吧,对你有用就留着,没用就不管。
VB中的键码常数 键码值 描述
-------------------------------------------------------------------
vbKeyLButton 1 鼠标左键
-------------------------------------------------------------------
vbKeyRButton 2 鼠标右键
-------------------------------------------------------------------
vbKeyCancel 3 CANCEL 键
-------------------------------------------------------------------
vbKeyMButton 4 鼠标中键
-------------------------------------------------------------------
vbKeyBack 8 Backspace 键
-------------------------------------------------------------------
vbKeyTab 9 TAB 键
-------------------------------------------------------------------
vbKeyClear 12 CLEAR 键
-------------------------------------------------------------------
vbKeyReturn 13 Enter 键
-------------------------------------------------------------------
vbKeyShift 16 Shift 键
-------------------------------------------------------------------
vbKeyConterol 17 Ctrl 键
-------------------------------------------------------------------
vbKeyMenu 18 菜单键
-------------------------------------------------------------------
vbKeyPause 19 PAUSE 键
-------------------------------------------------------------------
vbKeyCapital 20 CAPS LOCK 键
-------------------------------------------------------------------
vbKeyEscape 27 ESC 键
-------------------------------------------------------------------
vbKeySpace 32 SPACEBAR 键
-------------------------------------------------------------------
vbKeyPageUp 33 PAGEUP 键
-------------------------------------------------------------------
vbKeyPageDown 34 PAGEDOWN 键
-------------------------------------------------------------------
vbKeyEnd 35 END 键
-------------------------------------------------------------------
vbKeyHome 36 HOME 键
-------------------------------------------------------------------
vbKeyLeft 37 LEFT ARROW 键←
-------------------------------------------------------------------
vbKeyUp 38 UP ARROW 键↑
-------------------------------------------------------------------
vbKeyRight 39 RIGHT ARROW 键→
-------------------------------------------------------------------
vbKeyDown 40 DOWN ARROW 键↓
-------------------------------------------------------------------
vbKeySelect 41 SELECT 键
-------------------------------------------------------------------
vbKeyPrint 42 PRINT SCREEN 键
-------------------------------------------------------------------
vbKeyExecute 43 EXECUTE 键
-------------------------------------------------------------------
vbKeySnapshot 44 SNAP SHOT 键
-------------------------------------------------------------------
vbKeyInser 45 INSERT 键
-------------------------------------------------------------------
vbKeyDelete 46 DELETE 键
-------------------------------------------------------------------
vbKeyHelp 47 HELP 键
-------------------------------------------------------------------
vbKey0 48 0 键
-------------------------------------------------------------------
vbKey1 49 1 键
-------------------------------------------------------------------
vbKey2 50 2 键
-------------------------------------------------------------------
vbKey3 51 3 键
-------------------------------------------------------------------
vbKey4 52 4 键
-------------------------------------------------------------------
vbKey5 53 5 键
-------------------------------------------------------------------
vbKey6 54 6 键
-------------------------------------------------------------------
vbKey7 55 7 键
-------------------------------------------------------------------
vbKey8 56 8 键
-------------------------------------------------------------------
vbKey9 57 9 键
-------------------------------------------------------------------
vbKeyA 65 A 键
-------------------------------------------------------------------
vbKeyB 66 B 键
-------------------------------------------------------------------
vbKeyC 67 C 键
-------------------------------------------------------------------
vbKeyD 68 D 键
-------------------------------------------------------------------
vbKeyE 69 E 键
-------------------------------------------------------------------
vbKeyF 70 F 键
-------------------------------------------------------------------
vbKeyG 71 G 键
-------------------------------------------------------------------
vbKeyH 72 H 键
-------------------------------------------------------------------
vbKeyI 73 I 键
-------------------------------------------------------------------
vbKeyJ 74 J 键
-------------------------------------------------------------------
vbKeyK 75 K 键
-------------------------------------------------------------------
vbKeyL 76 L 键
-------------------------------------------------------------------
vbKeyM 77 M 键
-------------------------------------------------------------------
vbKeyN 78 N 键
-------------------------------------------------------------------
vbKeyO 79 O 键
-------------------------------------------------------------------
vbKeyP 80 P 键
-------------------------------------------------------------------
vbKeyQ 81 Q 键
-------------------------------------------------------------------
vbKeyR 82 R 键
-------------------------------------------------------------------
vbKeyS 83 S 键
-------------------------------------------------------------------
vbKeyT 84 T 键
-------------------------------------------------------------------
vbKeyU 85 U 键
-------------------------------------------------------------------
vbKeyV 86 V 键
-------------------------------------------------------------------
vbKeyW 87 W 键
-------------------------------------------------------------------
vbKeyX 88 X 键
-------------------------------------------------------------------
vbKeyY 89 Y 键
-------------------------------------------------------------------
vbKeyZ 90 Z 键
-------------------------------------------------------------------
vbKeyNum0 96 0 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum1 97 1 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum2 98 2 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum3 99 3 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum4 100 4 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum5 101 5 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum6 102 6 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum7 103 7 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum8 104 8 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyNum9 105 9 键 (在数字小键盘上)
-------------------------------------------------------------------
vbKeyMultiply 106 乘号(*) 键
-------------------------------------------------------------------
vbKeyAdd 107 加号(+) 键
-------------------------------------------------------------------
vbKeySeparator 108 Enter键(在数字小键盘上)
-------------------------------------------------------------------
vbKeySubtract 109 减号(-) 键
-------------------------------------------------------------------
vbKeyDecimal 110 小数点(.) 键
-------------------------------------------------------------------
vbKeyDivide 111 除号(/) 键
-------------------------------------------------------------------
vbKeyF1 112 F1 键
-------------------------------------------------------------------
vbKeyF2 113 F2 键
-------------------------------------------------------------------
vbKeyF3 114 F3 键
-------------------------------------------------------------------
vbKeyF4 115 F4 键
-------------------------------------------------------------------
vbKeyF5 116 F5 键
-------------------------------------------------------------------
vbKeyF6 117 F6 键
-------------------------------------------------------------------
vbKeyF7 118 F7 键
-------------------------------------------------------------------
vbKeyF8 119 F8 键
-------------------------------------------------------------------
vbKeyF9 120 F9 键
-------------------------------------------------------------------
vbKeyF10 121 F10 键
-------------------------------------------------------------------
vbKeyF11 122 F11 键
-------------------------------------------------------------------
vbKeyF12 123 F12 键
-------------------------------------------------------------------
vbKeyF13 124 F13 键
-------------------------------------------------------------------
vbKeyF14 125 F14 键
-------------------------------------------------------------------
vbKeyF15 126 F15 键
-------------------------------------------------------------------
vbKeyF16 127 F16 键
-------------------------------------------------------------------
vbKeyNumlock 144 NUM LOCK 键
-------------------------------------------------------------------
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询