Vbscript string variables with single and double quotes within string

Posted on 2014-03-25
Last Modified: 2014-03-25
Having trouble with single quotes and double quotes.

this is what i'm trying to put in a variable to pass in a function

this is what I thought I had to do.
xpth = "Browser(" & """ & "Title:=.*" & """ & ").Page(" & """ & Title:=.*" & """ & ").WebEdit(" & """ & "xpath:=//input[@name=" & "'user[username]']" & """ & ")""

then on other side I would like to put in function like (xpth.exist)
Question by:wendellpayne
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 27

Expert Comment

ID: 39953265
LVL 51

Accepted Solution

Rgonzo1971 earned 500 total points
ID: 39953306

With Chr(34) it 's easier

xpth = "Browser(" & Chr(34) & "Title:=.*" & Chr(34) & ").Page(" & Chr(34) & "Title:=.*" & Chr(34) & ").WebEdit(" & Chr(34) & "xpath:=//input[@name=" & "'user[username]']" & Chr(34) & ")"

Open in new window


Author Comment

ID: 39953406
Ok I  was able to get the string into a variable and here is my code so far
tl = 30
count = 0
itsthere = false

xpth = "Browser(" & """" & "Title:=.*" & """" & ")" & ".Page(" & """" & "(Title:=.*" & """" & ").WebEdit(" & """" & "xpath:=//input[@name='user[username]']" & """" & ")"


While (count < 30 and itsthere = false)
      If (Browser("Title:=.*").Page("Title:=.*").WebEdit("xpath:=//input[@name='user[username]']").Exist) Then
         itsthere = true
          msgbox ("Not there yet")
    End If
   wait(1)' 1 sec delay
  count = count + 1

Now I want to change the "IF" statement to something like this

IF (xpth.exist)

but xpth is string and not the xpath/browser object.
Any thoughts.

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question