我试图在 Linux 中使用 Wine 在 vbscript 下面运行,但它不起作用。其他 vbscript 函数按预期工作。
Wine 版本:wine-5.0.3 (Ubuntu 5.0.3-3) 命令:wine cscript ./test_rnd.vbs
VBS:
On Error Resume Next
WScript.Echo "Before Rnd"
Rnd -1
WScript.Echo "After Rnd"
If Err.Number <> 0 Then
WScript.Echo "Error : " & Err.Number & ": " & Err.Description
End If
使用 Wine 输出:
此脚本在 Windows 中运行良好。
我需要安装任何其他 wine 依赖项吗?如果您有任何在 Linux 中执行 VBS 的替代解决方案,请提及。
最佳答案
Rnd()
函数取决于 Randomize
statement 生成的种子它通过 Windows 操作系统功能操作系统系统计时器生成种子。虽然 Linux 会有类似的东西,但 VBScript 的代码库不知道如何调用它,而是取决于 Wine。提供模仿 Windows 系统计时器的实现。
因为您收到的错误是
Object doesn’t support this action
恐怕在 Wine 提供实现之前你就不走运了。
关于linux - Wine 中的 VB 脚本不返回 RND 函数的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67251192/