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 <[email protected]> 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 1-800-PRS-FILE 412-784-1615 Fax 412-400-3881 Cell/Text On Mon, Apr 24, 2017 at 5:50 PM, Tim Rude <[email protected]<mailto:[email protected]>> 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 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: ---FIRST PAGE HEADER--- ---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 [email protected]<mailto:[email protected]> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf
_______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf
