IF statement problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • amaru96
    Forum Member
    • Aug 2003
    • 8

    IF statement problems

    I'm trying to use a dialog box to get a Yes/NO answer which is stored in the variable called %confirmpath%. I try using a simple IF statament as a test and get the error message "Missing operator before parenthesis. There is an operator missing before the open parenthesis at position 4".

    This is the IF command I'm testing:

    IF (%confirmpath% = "YES)
    %Result2% = Dialog.MessageBox ("Title", "Test", Ok, Question)
    END IF

    I'm actually trying to use the Yes/No question as a way of proceeding after confirming a directory path. If the user clicks Yes (it is the correct path) how do I tell it to continue with the next command (hope that made sense).

    This is the code contained within a button:
    %path% = Registry.GetValueData ("HKEY_LOCAL_MACHINE\\SOFTWARE\Scripts\Installe d Apps\Scripts", "folder")
    %confirmpath% = Dialog.MessageBox ("Updater", "This will install the files to %path&, is this correct?", Yes|No, Question)
    If the user clicks yes I want it continue and do:
    File.Copy ("C:\Test\CD\files\*.*", "%path%\files")
    File.Copy ("C:\Test\CD\images\*.*", "%path%\images")

    Thanks to anyone who can help answer my question.
  • Lorne
    Indigo Rose Staff Member
    • Feb 2001
    • 2729

    #2
    Re: IF statement problems


    IF (%confirmpath% = "YES)
    You're missing a quotation mark after the YES.

    %path% = Registry.GetValueData ("HKEY_LOCAL_MACHINE\\SOFTWARE\Scripts\Installe d Apps\Scripts", "folder")
    All of those backslashes need to be escaped. (\\ instead of \)

    Not sure if these are just mistakes you made in your post, or in the project, but there you go.
    --[[ Indigo Rose Software Developer ]]

    Comment

    • amaru96
      Forum Member
      • Aug 2003
      • 8

      #3
      Re: IF statement problems

      Lorne, thanks for replying but they were typos in my post. Even this simple statement still gives me the error "Missing operator before parenthesis. There is an operator missing before the open parenthesis at position 4".

      IF (%confirmpath% = "YES")
      %Result2% = Dialog.MessageBox ("Title", "Test", Ok, Question)
      END IF

      Any suggestions?

      Comment

      • ovm
        Indigo Rose Customer
        • Oct 2002
        • 242

        #4
        Re: IF statement problems

        try this:

        File.Copy ("C:\Test\CD\files\*.*", "%path%files\*.*")
        File.Copy ("C:\Test\CD\images\*.*", "%path%images\*.*")


        gr.mario
        programming is very easy, just put the characters in the right order....

        Comment

        Working...
        X