[Dataperf] DP-created text file on user's desktop

Tim Rude timrude at hotmail.com
Tue Apr 25 20:51:42 CEST 2017

Thanks Ed! That's a very interesting idea. I'll play around with that one a bit.


On 4/25/2017 12:29 PM, Ed Marfil, MAST UNITED wrote:
Hi Tim,

I use your DPSpool method to create a text file.  I assigned a generic text file printer and simply selected that as one of the printers serving DPSpool.  Since it is in C drive, every time a user runs the report it creates the file in the user’s local computer.  The only thing I haven’t figured out is how to have the report automatically name itself.  Currently it prompts the user to enter the output filename.  Here is a process to add a generic text printer (skimmed from a website);
To create a text file printer you would do the following:

Go to Control Panel > Devices and Printers.
1.    Click 'Add a printer' at the top.
2.    Choose 'Add a local printer'.
3.    Select 'Use an existing port' and set it to "FILE: (Print to File)".
4.    Set the driver to Generic > Generic / Text Only. Click Next.
5.    Type in a name for the printer (e.g. Text File Printer). Click Next.
6.    Select "Do not share this printer" and click Next.
7.    Click Finish.

When you select that printer and "print" to it, you will be asked to enter an "Output File Name".
The resulting file will be an ASCII text file, and will contain the information that would be printed to any other standard printer, but in text form. This means that only text will be kept. All formatting will be stripped along with any images or other graphical elements.

Good luck.

From: Dataperf [mailto:dataperf-bounces at dataperfect.nl] On Behalf Of Tim Rude
Sent: Tuesday, April 25, 2017 5:42 AM
To: dataperf at dataperfect.nl<mailto:dataperf at dataperfect.nl>
Subject: Re: [Dataperf] DP-created text file on user's desktop

No, the actual file itself really needs to be on the desktop. But thanks for the suggestion!

As I ponder this, I'm starting to think that the subst method may actually be best, despite its drawbacks. Having the DP app able to just output to drive Q: to land something on the desktop is really handy. Plus, if the app gets run on a 64 bit machine using VDos, I can configure VDos to also have a Q: drive pointing to the user's desktop. Or if later another destination is preferred then Q: can be remapped in the batch file or VDos without having to change anything in the DP app. Since this is an in-house app used by only 4 user's (and I'm the IT guy), I can ensure that drive Q: remains available for my purposes.

I was actually posing the question more as a way to get ideas of how to get DP to output to user-specific folder(s) in a reliable and fairly bullet-proof manner, in case I (or anyone else here) needed to do so for a distributed app.

On April 25, 2017 12:38:53 AM CDT, Bob DeRosier <b_dataperfect at acozyplace.net><mailto:b_dataperfect at acozyplace.net> wrote:
Does it make sense to put a shortcut on the desktop and have the short cut point to the network location ?  You will need to work a small bit to distribute the shortcut.

On 4/24/2017 8:51 PM, Tim Rude wrote:
Yeah, I could do that, but I really want the destination to be the user's desktop. There's just one file that gets dropped there (but the content changes each time) and it needs to be on the desktop for ready access.

So far both of the approaches I described have worked, but neither is perfect, yet.

On April 24, 2017 9:14:16 PM CDT, Don Friedman <don at professionalrecords.com><mailto:don at professionalrecords.com> wrote:
You lost me here, Tim. Over my pay grade. Couldn't you set up a network location to save the text files that would be common?

Don Friedman
ProfessionalRecords.Com LLC
PRS Data Systems
205 S Main Street
Pittsburgh, PA   15215
412-784-1615 Fax
412-400-3881 Cell/Text

On Mon, Apr 24, 2017 at 5:50 PM, Tim Rude <timrude at hotmail.com<mailto:timrude at hotmail.com>> wrote:
I need DP to be able to create a text file on the user's desktop. Sounds
simple enough, but the folder that actually appears as the desktop is
different for every user. For user TRR, the folder (on Win7) is
C:\Users\TRR\Desktop, but for user JoeBob the folder is
C:\Users\JoeBob\Desktop. I didn't see any way inside of DP to determine
the correct folder, and DP doesn't translate environment variables (so
asking DP to output to %USERPROFILE%\Desktop doesn't work).

I'm presently using the /SID=sessionID command line with DP. I always
the start the database from a batch file, so I made the command-line in
the batch file this:

     DP.EXE database.str /SID=%USERPROFILE%

Now inside my DP reports, I can access the passed SID value as
user.field[0]. This is valid even if the database has no UserID panel

So, to output a text file on the user's desktop, I configure the report
to initially output to C:\NUL. Then at the very beginning of the report
I have the following:

---Store Value in Report Variable 250 ---
---Turn File Off---
---Begin Writing to Filename in Report Variable 250 ---
---Turn File On---

This works fine as long as all parts of the desktop path fit the 8.3
specs. But for XP there are spaces in the %USERPROFILE% so it's a no-go
for XP. And if a username had spaces in it (is that allowed?) or was
longer than 8 chars, it won't work under any OS. Anybody know a quick
way to (inside a batch file) convert a long path to a short (8.3) one?

One other idea that I've floated around is to include this in the batch

subst /d Q: > nul
subst Q: "%userprofile%/Desktop"
DP.EXE database.str
subst /d Q: > nul

Then in my DP reports, I simply output to Q:\output.txt. That seems to
get around the 8.3 issues for DP nicely, but is a bit messier since its
effects aren't contained to the database (i.e. the user sees a drive Q:
in My Computer while the database is running, and what happens if the
user already has Q: mapped to something...).

One other thing of note is that the database does not run under Shell,
so no shell/macro-based solutions are viable.

Any better suggestions or ideas?

Tim Rude
Dataperf mailing list
Dataperf at dataperfect.nl<mailto:Dataperf at dataperfect.nl>


Dataperf mailing list

Dataperf at dataperfect.nl<mailto:Dataperf at dataperfect.nl>


[Image removed by sender.]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon>

Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link>

Dataperf mailing list
Dataperf at dataperfect.nl<mailto:Dataperf at dataperfect.nl>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dataperfect.nl/pipermail/dataperf/attachments/20170425/c7cf95ae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ATT00001.jpg
Type: image/jpeg
Size: 350 bytes
Desc: ATT00001.jpg
URL: <http://lists.dataperfect.nl/pipermail/dataperf/attachments/20170425/c7cf95ae/attachment-0001.jpg>

More information about the Dataperf mailing list