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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update .bat file with variable info from Foxpro program 1

Status
Not open for further replies.

eboughey1008

Programmer
Jan 6, 2009
31
US
I want the job number which is a variable to update in the .bat file but I've not been able to do it.

I tried to strtofile() but it takes it literally and puts alltrim(listno) instead of the job number. Can I run some type of 'update' command for a text file? I can't find what I'm looking for anywhere.. Hard line text no problem but variable info updating to the file? not easy to find.

CLOSE ALL
CLEAR
SET SAFETY OFF

CLIST_NO = SPACE (15)

@ 11,5 say 'Enter List_no Value for sales import: ' get CLIST_NO
READ
CLEAR

**** DOES A BUNCH OF STUFF ******

listno = LEFT(CLIST_NO,5)

*** COPIES THE FILE TO BE UPLOADED FOR NCOA ***

COPY fields record_id, first, last, address, address2, city, state, zip to ALLTRIM(lcJobDir)+"NCOA-"+alltrim(listno)+".csv" DELIMITED WITH "" with CHARACTER tab

*** GOES TO THAT DIRECTORY ***

cExport="e:\working\ncoa\incoming"
SET DEFAULT TO "&cExport"

**************PROBLEM COMMAND ******************** (had to use single quotes around command)

STRTOFILE('e:\working\ncoa\incoming\truencoa.exe "E:\working\ncoa\incoming\NCOA-"+ALLTRIM(LISTNO)+".csv" "username" "pass" " true"','e:\working\ncoa\incoming\truencoa.bat')


Can anyone help with this? probably an easy fix....

Elena
 
And this doesn't look right at all:

Code:
STRTOFILE('e:\working\ncoa\incoming\truencoa.exe "E:\working\ncoa\incoming\NCOA-"+ALLTRIM(LISTNO)+".csv" "username" "pass" 
"[URL unfurl="true"]https://app.website/api/"[/URL] true"','e:\working\ncoa\incoming\truencoa.bat')

The syntax is completely wrong, and the command doesn't make any sense.

Rather than trying to correct it, if you could could tell us exactly what you want it to achieve, we can show you how to do it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi again Elena,

I've now had a closer look at your code. I have re-writtenit like this (see below). I'm not saying that my version is corect. Basically, all I have done is to split it up into several lines. But this makes it much more readable, and therefore easier to see what is wrong.

Code:
LOCAL lcCommand, lcFile

lcCommand = ;
 [e:\working\ncoa\incoming\truencoa.exe "E:\working\ncoa\incoming\NCOA-"] ;
 + ALLTRIM(LISTNO) +  [.csv username pass [URL unfurl="true"]https://app.website/api/[/URL] true]

lcFile = [e:\working\ncoa\incoming\truencoa.bat] 
STRTOFILE(lcCommand, lcFile)

You'll notice that Ive used square brackets rather than single quotes for the outer delimiters. There is nothing wrong with single quotes in this context, but square brackets are a bit easier to distinguish from quote marks.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
That worked perfectly Mike....

I was just using some similar programming from something I wrote years ago but it's not nearly as neat and clean as this! Oh and I didn't know about the brackets or I would have certainly used those.

Thanks so very much! I'd been working on this for 2 days before I thought to come out here.

Have a blessed Day

Elena
 
Glad to have helped, Elena.

And, by the way, it's good to see that you are still active in VFP. You might not remember, but we were involved in a small bit of work together a few years ago (actually, a lot of years ago).

Do come back next time you have a FoxPro problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 

I've been doing this for 25+ years. Mostly data processing and trying to streamline processes with programs (probably ones you helped me write :) )

I've had to change usernames on here for some reason about 10 years ago. i think my original was just eboughey.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top