udfGetFunctionNameParams
arr udfGetFunctionNameParams ()
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfGetFunctionNameParams ()
strListStackInfo = ItemRemove (-1, IntControl (77, 72, 0, 0, 0), @LF) ; Remove last stack entry.
strScriptLine = ItemExtract (4, ItemExtract (-1, strListStackInfo, @LF), @TAB) ; Get previous script line.
If StrIndexWild (strScriptLine, "*=*(*)*", 1) Then strScriptLine = ItemRemove (1, strScriptLine, "=")
strFunctionName = StrTrim (ItemExtract (1, strScriptLine, "("))
strFunctionParams = StrTrim (ItemRemove (-1, ItemRemove (1, strScriptLine, "("), ")"))
Return Arrayize (strFunctionName : @LF : strFunctionParams, @LF)
;..........................................................................................................................................
; This UDF "udfGetFunctionNameParams" returns an array of two elements.
; A[0] ... The function name of the calling function.
; A[1] ... The parameter list of the calling function.
;
; Inspired by
;   Conf:  WinBatch Script Exchange
;   From:  tlove tlove@tjlovejr.com
;   Date:  Thursday, May 03, 2012 09:41 AM
;
; (c)Detlev Dalitz.20120503.
;..........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.
DirChange (DirScript ())

#DefineFunction udfTest (p1, p2, p3, p4, p5)
arrResult = udfGetFunctionNameParams ()
Pause ("Function Name and Parameters", arrResult[0] : @LF : @LF : arrResult[1])
#EndFunction


arrResult = udfGetFunctionNameParams ()
Pause ("Function Name and Parameters", arrResult[0] : @LF : @LF : arrResult[1])


intResult = udfTest (1, 2, "a", "b", @TRUE)

udfTest (@TRUE, 2 * @PI, "ccc", 4, 5)

:CANCEL
Exit