如何传递变量? [英] How to Pass Variable?

查看:51
本文介绍了如何传递变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建如下代码.我想在

I create code like following. I want to pass the variable rand and randd in the

iret = iim2.iimPlay("rand")
iret = iim1.iimPlay("randd")

如何做到这一点?

Set iim1= CreateObject ("imacros")
Set iim2= CreateObject ("imacros")

Dim max,min,rand,randd,maxx,minn
max=2
min=15
Randomize
rand = Int((max-min+1)*Rnd+min)
WScript.Echo rand

maxx=2
minn=15
Randomize
randd = Int((maxx-minn+1)*Rnd+minn)
WScript.Echo randd

For m = 1 to 1
  iim1.iimInit("-fx -fxProfile t2")
  iim2.iimInit("-cr")

  iret = iim2.iimPlay("rand")
  iret = iim1.iimPlay("randd")

  iret = iim2.iimExit()
  iret = iim1.iimExit()
Next

推荐答案

去掉引号:

iret = iim2.iimPlay(rand)
iret = iim1.iimPlay(randd)

VBScript 不会在引号中扩展变量,因此 "rand" 作为文字字符串 "rand" 而不是变量 rand 的值传递.

VBScript does not expand variables in quotes, so "rand" is passed as the literal string "rand" instead of the value of the variable rand.

这篇关于如何传递变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆