"hello", said the registry

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dev_web
    Forum Member
    • Jun 2005
    • 5

    "hello", said the registry

    My software is using an if statement to see if a certain registry key equals a certain value. It stores the registry's key value in a variable called Def_web. it checks to see if the variable "Def_web" = "E:\Program Files\Internet Explorer\iexplore.exe -nohome" including the quotation marks. But if I enter it as: if (Def_web == ""E:\Program Files\Internet Explorer\iexplore.exe" -nohome" ) it has an error because of the quotation marks.
    What can I do?

    Please Help
    I have been working on this for days to no end...
    and all help is greatly appreciated
  • Dermot
    Indigo Rose Customer
    • Apr 2004
    • 1791

    #2
    Hi

    You need to escape the two quotation marks so that the scripting engine knows that they are part of the string.

    if (Def_web == "\"E:\Program Files\Internet Explorer\iexplore.exe\" -nohome" )

    Dermot
    Dermot

    I am so out of here :yes

    Comment

    • dev_web
      Forum Member
      • Jun 2005
      • 5

      #3
      Oh Boy!

      Thanks So Much!!!!

      Comment

      • bule
        Indigo Rose Customer
        • May 2005
        • 1116

        #4
        backslases are also requred for literal backslashes
        Never know what life is gonna throw at you. ZubTech

        Comment

        • dev_web
          Forum Member
          • Jun 2005
          • 5

          #5
          It still is not working...even with the back slashes

          Comment

          • Mark
            Indigo Rose Staff Member
            • Jun 2000
            • 1945

            #6
            Try this:

            Code:
            if (Def_web == "\"E:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome" ) then
            MSI Factory The Next Generation Intelligent Setup Builder

            Comment

            • Dermot
              Indigo Rose Customer
              • Apr 2004
              • 1791

              #7
              What error are you getting? Maybe if you post the complete code we can help. Have you checked the Def_web variable to see what it contains?

              Dialog.Message("Variable Contents", Def_web)

              Dermot
              Dermot

              I am so out of here :yes

              Comment

              • Dermot
                Indigo Rose Customer
                • Apr 2004
                • 1791

                #8
                Originally posted by Mark
                Try this:

                Code:
                if (Def_web == "\"E:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome" ) then
                I had thought of this Mark but had assumed that if the value of Def_web was read from the registry it would not have the escape backslashes. Maybe I am wrong.

                Dermot
                Dermot

                I am so out of here :yes

                Comment

                • dev_web
                  Forum Member
                  • Jun 2005
                  • 5

                  #9
                  Ohhhhhh Yeah!

                  IT WORKED! IT'S WORKING! REJOICE! thank you so so so so so much everbody!

                  Comment

                  • Dermot
                    Indigo Rose Customer
                    • Apr 2004
                    • 1791

                    #10
                    So what was the problem? How did you get it to work?

                    Dermot
                    Dermot

                    I am so out of here :yes

                    Comment

                    • Mark
                      Indigo Rose Staff Member
                      • Jun 2000
                      • 1945

                      #11
                      Originally posted by Dermot
                      I had thought of this Mark but had assumed that if the value of Def_web was read from the registry it would not have the escape backslashes. Maybe I am wrong.
                      Well you are partly right, the value read from the registry won't have the escaped backslashes, but the value you compare it against must have the backslashes escaped.

                      From the Help file:

                      The backslash and quote (\") is known as an escape sequence. An escape sequence is a special sequence of characters that gets converted or “translated” into something else by the script engine. Escape sequences allow you to include things that can’t be typed directly into a string.
                      So when the script engine looks at the string it doesn't see the "\\" it just sees "\". If you just pass it one "\" the script engine won't see it, it will read it as an escape sequence.
                      MSI Factory The Next Generation Intelligent Setup Builder

                      Comment

                      • Dermot
                        Indigo Rose Customer
                        • Apr 2004
                        • 1791

                        #12
                        Of course, that makes sense. Don't know what I was thinking of.

                        Dermot
                        Dermot

                        I am so out of here :yes

                        Comment

                        Working...
                        X