#1
|
|||
|
|||
Multiline macro-expanding
I have a macro LIST_NOSIGNIFICANT_CHANGES and the value is:
.ver .AssemblyFileVersionAttribute .AssemblyConfigurationAttribute %INITIAL_VERS% %END_VERS% Cultur When I open it into Macros view-the value appears correctly ,instead %INITIAL_VERS% appears 7.3.0.73 and instead END_VERS is 7.3.0.79. I need to make a search in a string (FoundStr),to see if any of the lines from the macro LIST_NOSIGNIFICANT_CHANGES is contained into this string. In order to do this I have made VBScript step like this: Set lnc = vbld_AllMacros()("LIST_NOSIGNIFICANT_CHANGES") a = Split(lnc,vbCrLf) arraySize = UBound(a) i=0 For Each arrayElement In a 'Wscript.Echo "Elem "&i&" is :"&a(i) 'verify if current array elem is contained in FoundStr If InStr(FoundStr,a(i)) Then 'contained,change is non significant strMessage="Current section contains string "&a(i)&" -change is not significant" Wscript.Echo strMessage Exit Sub 'current section does not contain any significant change Else ' not contained,search for next string from the list with non significant changes strMessage="Current section does not contain string "&a(i) Wscript.Echo strMessage End If i=i+1 Next Problem is in this step -the lines %INITIAL_VERS% and %END_VERS% are taken as literal and not as their value. I tried to avoid this by getting the macro a different way: strListNoSignificantChanges=Application.ExpandMacr os("%LIST_NOSIGNIFICANT_CHANGES%") but in such a case the step raises an unknown error,I guess because macro LIST_NOSIGNIFICANT_CHANGES is a multiline one. Question is -how can I perform the required search with the lines %INITIAL_VERS% %END_VERS% expanded? |
#2
|
|||
|
|||
strListNoSignificantChanges=Application.ExpandMacr os("%%LIST_NOSIGNIFICANT_CHANGES%%")
|
#3
|
|||
|
|||
Tks a lot,this solved the issue!
|
|
|