The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "iimSet()"
Line 8: | Line 8: | ||
*String VARNAME | *String VARNAME | ||
− | *:A string defining which variable is to be set. Use VARNAME to create a user defined variable named VARNAME. | + | *:A string defining which variable is to be set. The variable is created by iimSet. It does not have to be defined somewhere. Use VARNAME to create a user defined variable named VARNAME. Note: You can ''not'' use any of the [[Command_Reference#Built-In_Variables|built-in variables]] with iimSet. |
*String VARVALUE | *String VARVALUE | ||
*:The value which is to be assigned to the variable. | *:The value which is to be assigned to the variable. |
Revision as of 15:08, 19 September 2008
Assigns values to variables. There are limitations as to what variables you can set using this command. You can set all built-in variables which you also can set via the command line. Additionally, you can set all user defined variables. After iimPlay all variables are erased. The return code is always 0.
Syntax
int ret_code = iimSet ( String -var_VARNAME, String VARVALUE )
Parameters
- String VARNAME
- A string defining which variable is to be set. The variable is created by iimSet. It does not have to be defined somewhere. Use VARNAME to create a user defined variable named VARNAME. Note: You can not use any of the built-in variables with iimSet.
- String VARVALUE
- The value which is to be assigned to the variable.
- In contrast to TAG commands, blank spaces must not be replaced by <SP>. iimSet() takes care of that.
Examples
Loop over a number, for example to extract one table element after the other
Dim imacros, iret, i Set imacros = CreateObject("imacros") iret = imacros.iimInit() For i=0 To 4 ' You have to convert the value into a string! iret = imacro.iimSet("-var_myloop", CStr(i)) iret = imacros.iimPlay("mymacro") Next
Note that variables defined with iimSet lose their values after each iimPlay. This is by design. If you want to use the same variables and values in another macro, you need to use iimSet again:
iret = imacro.iimSet("-var_greeting", "hello") iret = imacros.iimPlay("1st-macro") iret = imacro.iimSet("-var_greeting", "hello") iret = imacros.iimPlay("2nd-macro")