udfItemListExecute
str udfItemListExecute (str, str, int)
#DefineFunction udfItemListExecute (strItemList, strDelimiter, intMode)
strResultList = ""
intCount = ItemCount (strItemList, strDelimiter)
For intElem = 1 To intCount
   strItem = ItemExtract (intElem, strItemList, strDelimiter)
   strVar = ItemExtract (1, strItem, "=")
   %strItem%
   Select intMode
   Case 0
      strResultList = ItemInsert (StrCat (strVar, "=", %strVar%), -1, strResultList, strDelimiter)
      Break
   Case 1
      strResultList = ItemInsert (strVar, -1, strResultList, strDelimiter)
      Break
   Case 2
      strResultList = ItemInsert (%strVar%, -1, strResultList, strDelimiter)
      Break
   Case intMode
      strResultList = ""
      Break
   EndSelect
Next
Return strResultList
;..........................................................................................................................................
; This UDF udfItemListExecute executes WinBatch statements which are stored as items in an itemlist.
; Input parameter strItemList is a list of expression items "var=expression" delimited by strDelimiter,
; e.g. strItemList = StrCat ("a=1+2", @tab, "b=2**4")
;
; intMode = 0  returns a list of items "var=value"
; intMode = 1  returns a list of items "var" only
; intMode = 2  returns a list of items "value" only
;
; Detlev Dalitz.20020318
;..........................................................................................................................................
#EndFunction


; Test.

strMsgTitle = "Demo: udfItemListExecute (strItemList, strDelim, intMode)"

strDelim = ";"
strExecList = StrCat ("a=1+2", strDelim, "b=2**4", strDelim, "c1=a+b", strDelim, "c2=a-b", strDelim, "d=c1*c2")

strMsgText = StrCat (strExecList, @LF, udfItemListExecute (strExecList, strDelim, 0)) ; "a=3;b=16;c1=19;c2=-13;d=-247"
Pause (strMsgTitle, strMsgText)

strMsgText = StrCat (strExecList, @LF, udfItemListExecute (strExecList, strDelim, 1)) ; "a;b;c1;c2;d"
Pause (strMsgTitle, strMsgText)

strMsgText = StrCat (strExecList, @LF, udfItemListExecute (strExecList, strDelim, 2)) ; "3;16;19;-13;-247"
Pause (strMsgTitle, strMsgText)

Exit