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

Tim Rude timrude at hotmail.com
Wed Apr 26 06:27:49 CEST 2017

Hi Colin,

I'm also using an adaptation of my suggested RV250 formula to send the 
output to the desktop. However, I want to avoid having to ask the user 
for anything about the target location. I'm wanting it to automagically 
drop the file on the user's local desktop.

I think, after the back and forth here, I've got an idea that will be 
reliable and (hopefully) bulletproof. I've got some more testing and 
tweaking to do but I'll post back once I've got the completed solution.

Thanks for the input!

Tim Rude

On 4/25/2017 1:36 PM, Colin Roberts wrote:
> Hi Tim,
> If I understand correctly I sorta have been doing this for a while (I 
> think)
> Current OS is Windows Server 2003 but we had NT with Citrix overlay 
> prior and this format DPspool report also worked on NT.
> Each user has their own file for DPSpool output
> path is: C:\Documents and Settings\"username"\dpspool\printdoc (Users 
> Dpspool folder only has printdoc in it)
> so example top of report"
> --------------------Prompt for Value of Report Variable 249 
> ------------------
> --------------------Store Value in Report Variable 250 
> -----------------------
> --------------------Turn File 
> Off--------------------------------------------
> --------------------Begin Writing to Filename in Report Variable 250 
> --------
> --------------------Turn File 
> On---------------------------------------------
> RV249 prompts for user initials which is "username"
> RV 250 is an adaptation of your suggested RV250
> cat.c["c:\docume~1\"RV249"\dpspool\printdoc\";
>    apply.format["G999";today - date[1;1;year[today]] + 1]
>        apply.format["G99999";now];
>         ".{5}"]
> Maybe I'm missing something but maybe replacing
> cat.c["c:\docume~1\"RV249"\dpspool\printdoc\";
> with
> cat.c["c:\docume~1\"RV249"\desktop\printdoc";
> could achieve what you want.
> (This is of course the servers' user desktop not the client user 
> desktop which maybe a different story)
> A few maybes there, but hopefully something you can possibly work with.
> Regards
> Colin Roberts
> ----- Original Message ----- From: "Tim Rude" <timrude at hotmail.com>
> To: <dataperf at dataperfect.nl>
> Sent: Tuesday, April 25, 2017 9:50 AM
> Subject: [Dataperf] DP-created text file on user's desktop
>> 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
>> defined.
>> 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 ---
>>     cat.t[user.field[0];"\Desktop\output.txt"]
>> ---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
>> file:
>> 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
>> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf
> _______________________________________________
> Dataperf mailing list
> Dataperf at dataperfect.nl
> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf

More information about the Dataperf mailing list