?
Solved

Vbscript string variables with single and double quotes within string

Posted on 2014-03-25
3
Medium Priority
?
1,029 Views
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
Browser("Title:=.*").Page("Title:=.*").WebEdit("xpath:=//input[@name='user[username]']")

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)
0
Comment
Question by:wendellpayne
[X]
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
3 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39953265
.
0
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 39953306
Hi,

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

Regards
0
 

Author Comment

by:wendellpayne
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]']" & """" & ")"

'MsgBox(xpth)

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

*************************************************
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.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

801 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