Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing quoted literal string to a program from a variable

Status
Not open for further replies.

Apata

Programmer
Apr 5, 2006
52
US
Hi all:

I checked out thread184-1005051 which has a lot of useful information for this problem but I still couldn't find a solution.

I am running a program within VFP that needs a literal string with quotation marks sent to it. Like "This is a test". For example, this code works:
Code:
RUN /N2 c:\thisprog.exe "How are you doing?"

The string I need to pass to the program is in my editbox. I've used the following methods and none has worked:
Code:
RUN /N2 c:\thisprog.exe chr(34)+Thisform.Editbox.Value+chr(34)
or
Code:
a=Thisform.Editbox.Value
RUN /N2 c:\thisprog.exe ["&a"] && or chr(34)+&a+chr(34)

The program just takes whatever I've passed to it in these instance very literally.

I appreciate your help.
 
Try building the whole command string in a single variable and then macro executing it:

Code:
cCommand = [RUN /N2 c:\thisprog.exe "] + ThisForm.EditBox.Value + "["
&cCommand

Tamar
 
Okay, let's fix that:

Code:
cCommand = [RUN /N2 c:\thisprog.exe "] + ThisForm.EditBox.Value + ["]
&cCommand

Tamar
 
Tried this with 2 forms..Not a Run exe.

First form has an edit box. Replicated "X" 100 times as its value. It has a command button, and in its Click:
DO FORM form2 WITH '"'+thisform.edit1.value+'"'

Form2 has a Parameter in Init() which displays the value passed in a wait window. It displays with the quotes

May/Maynot work with RUN
 
read as
DO FORM form2 WITH ' " '+thisform.edit1.value+' " '
Enclose the double quotes with single quotes

 
Thanks so much guys. Those have been very helpful. What about in transposing a quote in a memo. For example, turning the underlined:
Code:
"This is an example[u]".[/u]
to:
Code:
"This is an example[u]."[/u]
 
Thanks, I got it.
REPLACE Memo WITH STRTRAN(Memo, '”.', '.”')
It didn't work for me at first because I needed to put the curly quotes instead of the straight quote, which is not easily detectable in a VFP window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top