NSIS 检查文本框为空不起作用

发布于 2024-08-28 10:46:13 字数 1010 浏览 10 评论 0原文

我试图在 NSIS 中显示一个页面以获得两个不同的值。我希望两者都不为空。该页面实际上显示,但我无法让我的页面离开功能正确检查空字段。

Function CCInstallOpts
  ReserveFile "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "cc_installopt.ini"    
FunctionEnd

我验证字段( 4 和 5 )的页面离开功能是:

Function CCInstallOptsLeave

    Push $R0
    Push $R1

    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field4" "State"
    !insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field5" "State"
    StrCmp $R0 "" mustcomplete
    StrCmp $R1 "" mustcomplete
    StrCpy $CC_CyberID $R0
    StrCpy $CC_VCode   $R1

    goto exitfunc

mustcomplete:

     MessageBox MB_OK|MB_ICONEXCLAMATION "Empty not allowed"
     Abort

exitfunc:

     Pop $R1
     Pop $R0

FunctionEnd

请注意,我想将输入的值存储到 $CC_VCode 和 $CC_Cyber​​ID 变量中,以便稍后在不同的文件上使用(我将两者定义为:)

Var /GLOBAL CC_VCode
Var /GLOBAL CC_CyberID

提前致谢。

I'm trying to display a page in NSIS to obtain two different values. I want both to be not empty. The page actually displays altough I can't get my page leave function to check properly for empty fields.

Function CCInstallOpts
  ReserveFile "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "cc_installopt.ini"
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "cc_installopt.ini"    
FunctionEnd

My page leave function where I validate fields (4 and 5 ) is :

Function CCInstallOptsLeave

    Push $R0
    Push $R1

    !insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field4" "State"
    !insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field5" "State"
    StrCmp $R0 "" mustcomplete
    StrCmp $R1 "" mustcomplete
    StrCpy $CC_CyberID $R0
    StrCpy $CC_VCode   $R1

    goto exitfunc

mustcomplete:

     MessageBox MB_OK|MB_ICONEXCLAMATION "Empty not allowed"
     Abort

exitfunc:

     Pop $R1
     Pop $R0

FunctionEnd

Note that I want to store the entered values into $CC_VCode and $CC_CyberID variables to be later used on different files (I've defined both as:)

Var /GLOBAL CC_VCode
Var /GLOBAL CC_CyberID

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

活泼老夫 2024-09-04 10:46:13

您在字段名称中缺少空格

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field 5" "State"

You are missing a space in the field name

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "cc_installopt.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "cc_installopt.ini" "Field 5" "State"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文