not a valid path using %username% in printer file support path

not a valid path using %username% in printer file support path

ian
Contributor Contributor
821 Views
11 Replies
Message 1 of 12

not a valid path using %username% in printer file support path

ian
Contributor
Contributor

Good Afternoon.

 

I having a problem with my lisp file.  I have have managed to set up to add trusted and support file paths, using the %username% in the file paths.  We are needing to update the paths because we are moving from network drives to SharePoint/OneDrive.  We want everyone to link to files on SharePoint, via the one drives.  so each path needs to contain individual usernames when loading.

 

It all works with the exception of the Printer support paths.  has anyone any idea what I'm missing?

 

AutoCAD.PNG

 

;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "C:\\Users\\%username%\\OneDrive - ###############\\02_Model and Design Support\\AutoCAD_Support Folder\\Plotters\\PMP Files;")

 

0 Likes
Accepted solutions (2)
822 Views
11 Replies
Replies (11)
Message 2 of 12

pbejse
Mentor
Mentor

@ian wrote:

(vla-put-PrinterDescPath *files* "C:\\Users\\%username%\\OneDrive - ###############\\02_Model and Design Support\\AutoCAD_Support Folder\\Plotters\\PMP Files;")


try  %userprofile% 

 

 

Message 3 of 12

pendean
Community Legend
Community Legend
(strcat (getenv "userprofile") "\\OneDrive\\xyz") if you're already logged into OneDrive.
0 Likes
Message 4 of 12

ian
Contributor
Contributor

Thanks for the response's, but I'm still don't seem to be having any look with this.  still getting an error to say it does not exist.

 

It defiantly does

0 Likes
Message 5 of 12

pbejse
Mentor
Mentor
Accepted solution
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
)
(vla-put-printerdescpath *files* "%userprofile%\\DC\\YourPath")
0 Likes
Message 6 of 12

ian
Contributor
Contributor
"%userprofile%\\DC\\YourPath"

am i just replacing the YourPath with "C:\\Users\\%userprofile%\\OneDrive - ########\\02_Model and Design Support\\AutoCAD_Support Folder\\Plotters\\PMP Files

 

or replacing the whole thing, "%userprofile%\\DC\YourPath" with the above?

 

what does the DC stand for?

0 Likes
Message 7 of 12

pbejse
Mentor
Mentor

@ian wrote:

what does the DC stand for?


DC is just an example i used for this demo.

 

%userprofile% represents this part of the path  "C:\\Users\\pbejse"

This

 

"%userprofile%\\OneDrive"

 

 is read as

 

"C:\\Users\\pbejse\\OneDrive"

 

HTH

0 Likes
Message 8 of 12

ian
Contributor
Contributor
(setq *files* (vla-get-files (vla-get-preferences (vlax-get-acad-object)))
)
(vla-put-printerdescpath *files* "%userprofile%\\OneDrive - ##########\\02_Model and Design Support\\AutoCAD_Support Folder\\Plotters\\PMP Files"
  )

  Still not having any look I'm afraid

0 Likes
Message 9 of 12

ronjonp
Advisor
Advisor

@ian 

See @pendean response #3. (getenv "userprofile")

0 Likes
Message 10 of 12

ian
Contributor
Contributor

still having no luck with this.

 

All i can get to input to the path location is %userprofile%\OneDrive - Asda Stores Limited\02_Model and Design Support\AutoCAD_Support Folder\Plotters\PMP Files.

 

Which is invalid

0 Likes
Message 11 of 12

ronjonp
Advisor
Advisor
Accepted solution

This works for me..

(strcat
  (getenv "userprofile")
  "\\OneDrive - Asda Stores Limited\\02_Model and Design Support\\AutoCAD_Support Folder\\Plotters\\PMP Files"
)
0 Likes
Message 12 of 12

ian
Contributor
Contributor

thanks do much for the support, I got there in the end

0 Likes