我不确定我是否了解如何使用charStrip,因此我在下面创建了脚本,并且在$ current_compare上未显示任何内容,请提供帮助
我试图调用此函数,但是不起作用。
Exch $R0 #char <br/>
Exch <br/>
Exch $R1 #in string <br/>
Push $R2 <br/>
Push $R3 <br/>
Push $R4 <br/>
StrCpy $R2 -1 <br/>
IntOp $R2 $R2 + 1 <br/>
StrCpy $R3 $R1 1 $R2 <br/>
StrCmp $R3 "" +8 <br/>
StrCmp $R3 $R0 0 -3 <br/>
StrCpy $R3 $R1 $R2 <br/>
IntOp $R2 $R2 + 1 <br/>
StrCpy $R4 $R1 "" $R2 <br/>
StrCpy $R1 $R3$R4 <br/>
IntOp $R2 $R2 - 2 <br/>
Goto -9 <br/>
StrCpy $R0 $R1 <br/>
Pop $R4 <br/>
Pop $R3 <br/>
Pop $R2 <br/>
Pop $R1 <br/>
Exch $R0 <br/>
FunctionEnd <br/>
OutFile test.exe <br/>
Var /GLOBAL CURRENT_COMPARE <br/>
Section 1 <br/>
!macro CharStrip Char InStr OutVar <br/>
Push '.' <br/>
Push 'v8.11.3' <br/>
Call CharStrip <br/>
Pop '$CURRENT_COMPARE' <br/>
!macroend <br/>
MessageBox MB_OK $CURRENT_COMPARE <br/>
SectionEnd <br/>
答案 0 :(得分:0)
我假设您从Wiki修改了this code。
在您的示例中,您没有插入宏,因此从未调用CharStrip函数。您不应该修改宏,只需将正确的参数传递给它即可:
Function CharStrip
Exch $R0 #char
Exch
Exch $R1 #in string
Push $R2
Push $R3
Push $R4
StrCpy $R2 -1
IntOp $R2 $R2 + 1
StrCpy $R3 $R1 1 $R2
StrCmp $R3 "" +8
StrCmp $R3 $R0 0 -3
StrCpy $R3 $R1 $R2
IntOp $R2 $R2 + 1
StrCpy $R4 $R1 "" $R2
StrCpy $R1 $R3$R4
IntOp $R2 $R2 - 2
Goto -9
StrCpy $R0 $R1
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd
!macro CharStrip Char InStr OutVar
Push '${InStr}'
Push '${Char}'
Call CharStrip
Pop '${OutVar}'
!macroend
!define CharStrip '!insertmacro CharStrip'
Var /GLOBAL CURRENT_COMPARE
Section 1
${CharStrip} '.' 'v8.11.3' $CURRENT_COMPARE
MessageBox mb_OK $CURRENT_COMPARE
SectionEnd