?
Solved

How to specify OS variables from VFP

Posted on 2009-12-16
15
Medium Priority
?
804 Views
Last Modified: 2012-05-08
On a prior EE suggestion, I an using Bullzip to create PDF files.

Bullzip allows a user specified filename by using an environment variable.

I am trying to set up an environment variable with the run command. . .

RUN set pdfname=c:\pdfs\clientname

This works fine from the OS command window but NOT from the VFP command window.

I don't get any errors, but           ? GETENV('pdfname')             displays nothing
0
Comment
Question by:MichaelKatz
  • 7
  • 3
  • 3
  • +1
15 Comments
 
LVL 14

Assisted Solution

by:tusharkanvinde
tusharkanvinde earned 400 total points
ID: 26061466
Maybe you should print to the file and then rename the pdf to whatever you want. AFAIK you cannot change or add environment variables because the RUN command will create another instance in which the variable will be created, but the instance will immediately be closed.
0
 
LVL 43

Accepted Solution

by:
pcelba earned 800 total points
ID: 26061479
GETENV() returns parent process variables only (it obviously means variables set at OS level).

You may set the variable for VFP process by API call:

DECLARE INTEGER SetEnvironmentVariable IN kernel32 STRING lcVarName, STRING lcVarValue
lnSuccess = SetEnvironmentVariable("pdfname", "c:\pdfs\clientname")

Now you can see this variable in cmd window created from VFP by

! cmd

and it should be visible for Bullzip called from VFP, also.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26061483
SetEnvironmentVariable returns positive number if successful.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 14

Expert Comment

by:tusharkanvinde
ID: 26061568
P Celba.

I did not know about SetEnvironmentVariable. Thanks.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26061585
Me neither but the perfect http://www.news2news.com/vfp/?group=58&function=227 and Google exists :-)

Welcome on the sandbox, sudhir1979. Just FYI, you may test mesaages in Longue (http://www.experts-exchange.com/Other/Lounge/) or in Experts longue (http://www.experts-exchange.com/Other/Expert_Lounge/).
0
 

Author Comment

by:MichaelKatz
ID: 26062509
Thanks,

I'm making progress but it still doesn't work. The variable shows up in both the OS command window and when I create one from VFP  (! cmd).

I put   <env:c:\pdfs\clientname>   in the "File Name" text box of the "General" tab of the Bullzip "Options" dialog.

I set the "Save as" dialog to show only when "No file name is specified", but it still appears.

Should I be talking to Bullzip people.

Michael
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26063271
I am not using Bullzip but looking at its documentation (http://www.biopdf.com/guide/), you should set it following way (suppose the environment variable pdfname was created from VFP already):

Output=<env:pdfname>.pdf

<env:c:\pdfs\clientname> is most probably wrong because it is trying to read "c:\pdfs\clientname" variable which does not exist.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26063567
The
Output=<env:pdfname>.pdf
is in a format how it appears in .ini file

If you are creating settings from the dialog then <env:pdfname>.pdf  should be enough.

You wrote "The variable shows up in both the OS command window and when I create one from VFP  (! cmd)." which I don't partly understand.

Do you mean the pdfname variable apperas even when you did not create it in VFP? In such case it was probably created at OS level prior to VFP launch.
0
 
LVL 12

Assisted Solution

by:jrbbldr
jrbbldr earned 800 total points
ID: 26063800
We use Bullzip all the time to create 100's of uniquely named PDF documents every day with each document needing to go into unique date & client specific directories.

We have configured Bullzip to always write the PDF document to a single specific directory and always use a single 'fixed' filename.  
     Example:   Always create   C:\Temp\NewPDF.PDF

Then the VFP application can always 'find' the document and use its native commands to do whatever it wants to do with it such as   Move it to another directory and/or Rename it to another filename.

In that way, it greatly simplifies how things need to work.

Good Luck

0
 

Author Comment

by:MichaelKatz
ID: 26064585

oops,

This is what I have in the above mentioned textbox. . .

<env:usspdfname>

The variable does exist, and the value is a valid path including the filename.

Tje OutPut=. .  method should go in an ini file, which I am trying to avoid. According to the documentation the file is in an "application data" folder under the user who was logged on during the installation.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26064761
I've been trying to install Bullzip on Vista with no success...

I think jrbbldr suggested good work around.
0
 

Author Comment

by:MichaelKatz
ID: 26064839
pcelba,

I did also create it at the OS level, just in case.  I realize now that it is only in that one instance of command.com


jrbbldr,
My app will be distributed with the suggestion to use Bullzip. We have had many comments on the adobe dialog box.

Your idea is good, but I am still left with needing a way to configure Bullzip programatically.

0
 
LVL 12

Expert Comment

by:jrbbldr
ID: 26065340
" I am still left with needing a way to configure Bullzip programatically."

You might want to look for the Bullzip configuration file and either replace it with your own or modify it programatically.

I found my Bullzip config file
    C:\Documents and Settings\MyDir\Application Data\Bullzip\PDF Printer\settings@Bullzip PDF Printer.ini
NOTE - if there are multiple users on a given workstation, each may have their own Bullzip config file in their own   Documents and Settings   directory.

Good Luck

0
 
LVL 43

Expert Comment

by:pcelba
ID: 26065888
BTW, do you somebody use Bullzip in Vista?

The installation on my machine is not able to create one folder under Program files\Bullzip\... saying "Access denied".
0
 
LVL 12

Expert Comment

by:jrbbldr
ID: 26066706
I have no Bullzip installations using Vista (thank goodness!!!)

There is a Support Forum where there may be more info
    http://www.bullzip.com/phpBB/viewforum.php?f=21&sid=8bc4303fee6833f3aa9f9b7eb9df5409

And they have an support question email submittal form
   http://www.bullzip.com/contact.php



0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 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