I am looking for a way to save converted files to a specific folder based on which user is running the task.
Ex. Task name - Convert to PDF
User 'Harry' runs the 'Convert to PDF' task. The drawing is converted and saved to 'M:\PDFS\Harry'.
So the Output File Details would look something like
M:\PDFS\
I started to play around with 'Advanced Scripting Options' but I cant seem to figure out how to create a custom variable. I use the code below is a couple of my SolidWorks macro (VBA), which gets the username of the logged in user.
Any suggestions would be appreciated.
Thank you.
SolidworksSolidworks Pdm enterprise PdmFunction UserName() As String
Dim myShell
Dim content
Dim value
Set myShell = CreateObject("WScript.Shell")
For Each value In myShell.Environment("PROCESS")
content = Split(value, "=")
If content(0) = "USERNAME" Then UserName = content(1)
Next
'If UserName = "" Then UserName = "-"
Set myShell = Nothing
End Function