找回密码
 加入
搜索
查看: 4457|回复: 8

[AU3基础] 基础太差了,请指点问题出在哪里【已解决】

[复制链接]
发表于 2015-5-30 18:10:42 | 显示全部楼层 |阅读模式
本帖最后由 fenhanxue 于 2015-6-4 10:43 编辑

下面代码,运行后,为什么$a  只有一个字符,而不是十个字符?
Local $a 

For $i = 1 To 10
        $a &= _ceshi()
        
Next


MsgBox(0,'',$a)

Func _ceshi()
        $rand=Random(19968,40911,1)
        Return BinaryToString ($rand,2) 
EndFunc


已解决

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-5-30 23:17:44 | 显示全部楼层
本帖最后由 ila 于 2015-5-30 23:22 编辑

Dim $path="1.txt", $a[11],$i
$open=FileOpen($path,10)
    For $i = 1 To 10
                $a[$i]=_ceshi()
                FileWrite($open,$a[$i])
        Next
FileClose($open)
ShellExecute("notepad.exe",$path)
Func _ceshi()
            $rand=Random(19968,40911,1)
            Return BinaryToString ($rand,2)
    EndFunc
发表于 2015-5-31 11:30:03 | 显示全部楼层
本帖最后由 樱花雪月 于 2015-6-1 17:41 编辑


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-6-2 13:11:18 | 显示全部楼层
学习学习再学习
发表于 2015-6-2 13:47:32 | 显示全部楼层
LZ第13行BinaryToString() 这种方式生成的有些字符串是MsgBox()无法正常显示的,但可以写入到记事本中查看,第9行改为FileWrite('xx.x', $a)即可
不过,更怀疑LZ本身使用BinaryToString()就是个问题,改为ChrW()试试
发表于 2015-6-3 19:36:22 | 显示全部楼层
BinaryToString()转换的时候不是标准的二进制格式在后面自动加上一个类似回车或换行的符号,单行文本是看不全的。取ASCII字符用ChrW()较好。若是非得用BinaryToString()的话去掉最右一个字符就可以了。

Local $a
For $i = 1 To 10
        $a &= _ceshi()
Next
MsgBox(0,'',$a)
Func _ceshi()
        $rand=Random(19968,40911,1)
        Return StringTrimRight(BinaryToString ($rand,2),1)
EndFunc
发表于 2015-6-5 17:36:39 | 显示全部楼层
这都是什么字啊
发表于 2015-6-6 01:02:36 | 显示全部楼层
表示不懂。。。。。。。。。。。。。。
发表于 2015-6-7 22:00:55 | 显示全部楼层
Local $a
For $i = 1 To 10
    $a &= _ceshi()
Next
MsgBox(0, 0 ,$a)
Func _ceshi()
    Return StringStripCR( _
        BinaryToString( _
        Random(19968,40911,1), 2))
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 03:54 , Processed in 0.080977 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表