按键精灵脚本笔记:基本语法

Dim x  //申明变量x
x = "我是x变量"
TracePrint x  //在控制台打印出x变量

Dim a
a = 10
TracePrint a+5 //在控制台打印出a变量

Dim arr(5)   //数组申明
 arr(0) = "我是0号"
 arr(1) = "我是1号"
 arr(2) = 2
num = 0

For 5      //For 循环的用法
TracePrint arr(num)
num = num + 1
Next

aa = 9   //申明变量时候 Dim可以省略
If aa = 5 Then     //If条件语句的用法
TracePrint "aa等于5"
ElseIf aa = 6 Then
TracePrint "aa等于6"
ElseIf aa = 7 Then
TracePrint "aa等于7"
Else 
TracePrint "aa不等于5,6,7"
End If

KeyPress "w", 1 //按下键盘w键1次
KeyPress "r", 2 //按下键盘r键2次

TracePrint Cstr(aa)//把数字转换成字符串

bb = 0
While bb < 5   //while循环的用法
	TracePrint bb
	bb = bb+1
Wend

c1 = "我是"
c2 = "中国人"
TracePrint c1 & c2//字符串链接

Function test(a,b)  //函数定义
	TracePrint "结果 "&(a+b)
End Function

 Call test(5,6)    //函数调用


  • 13
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值