Skip to main content
Inspiring
July 12, 2020
Question

I want to specify the user's desktop in "cPath" specified in "saveAs" method..

  • July 12, 2020
  • 1 reply
  • 1100 views

I want to specify the user's desktop in "cPath" specified in "saveAs" method, but I don't know how to set the path.

 

What should I do with the location of "username" ?
Is it useless below?


Used in a multilingual environment.

this.saveAs("/c/Users/%userprofile%/" + aaa + ".pdf");

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
July 13, 2020

There's no direct way of doing it. What can be done, though, since you have to run your code from a trusted context anyway is to use the app.getPath method to access one of the other user folders, like the Documents ones, and from there get the Desktop path. It's a bit of a hack, but it does work, as long as keep in mind that it can vary per operating system.

Inspiring
July 13, 2020

very thank you for your advice. I've never used the app.getPath method, but I'll check it. The difference in operating system is the difference from Windows 10 or 7, right? Or is it Mac?

Inspiring
July 13, 2020

Create a text box in the field and put it there

var i = app.getPath("Documents");
event.value = i.value;

I wrote, but nothing is displayed. .. ..

Is something wrong?