本帖最后由 cashiba 于 2016-11-3 10:14 编辑
已经知道怎么调用ruby了,不过暂时没时间继续学习Ruby.
先把调用代码贴出来,抛砖引玉吧,哪位有心学ruby的可以继续研究啦......;调用前请先安装Ruby引擎:http://www.artonx.org/data/asr/ActiveRuby.msi
#include <Array.au3>
OperRubyArr()
func OperRubyArr()
local $rb = ObjCreate("scriptcontrol")
$rb.Language = "rubyscript"
$rb.eval("a = [1, 3, 4, 5, 7] ; b = [2, 3, 5, 7, 9]; c=a & b;")
local $res=$rb.eval("c.join(',')")
ConsoleWrite("重复值:" & $res & @CRLF)
$rb.eval ("a = [1, 3, 4, 5, 7] ; b = [2, 3, 5, 7, 9]; c=a + b;")
local $ult=$rb.eval("c.to_s")
ConsoleWrite("合并后:" & $ult & @CRLF)
$rb.eval ("a = [1, 3, 4, 5, 7] ; b = [2, 3, 5, 7, 9]; c=(a | b).sort;")
local $srt=$rb.eval("c.join(',')")
ConsoleWrite("合并去重排序后:" & $srt & @CRLF)
local $del=$rb.eval ("c = [0, 1, 6, 8, 10];c.delete_at 2")
local $del=$rb.eval("c.*(',')")
ConsoleWrite("删除其中一元素后:" & $del & @CRLF)
$rb.eval ("ary=[1, 3, 2, 2, 3].uniq ")
local $uni=$rb.eval("ary.*(',')")
ConsoleWrite("取唯一值后:" & $uni & @CRLF)
local $rvs=$rb.eval("'abcdefg'.reverse")
ConsoleWrite("倒转后:" & $rvs & @CRLF)
local $dir = $rb.Eval("Dir::entries('c:/') ")
_ArrayDisplay($dir,"C盘目录")
$rb=0
$rb.quit
EndFunc
|