Jump to content

Different Logfilepath depending on Username


Recommended Posts

Posted

Hello together,

 

I need help.

 

I have a emergency lisp for a bunch of User to set all System Variable back,

but this doesn't work for e.g. LOGFILEPATH

 

I tried this:

 

...

(setq xxx (getvar 'loginname))

(setq LOGP (strcat "\\\\Server\\Folder\\" xxx))

(setvar "LOGFILEPATH" LOGP)

...

 

Can anybody tell me what I'm doing wrong?

 

 

kind regards

Blueburd1973

Posted

Hi ronjonp,

 

No, the path exist.

 

I think the problem is the stored loginname at the symbol "xxx".

It seem that it doesn't connect at the STRCAT.

 

kind regards

Bluebird1973

Posted

I can only replicate an error if the path does not exist. Try this:

(if (findfile (setq path (strcat "\\\\Server\\Folder\\" (getvar 'loginname))))
 (setvar "LOGFILEPATH" path)
 (print (strcat path " not found..."))
)

Posted

I don't see why the xxx symbol would cause any issues, unless it contains a \ inside (which seems unlikely)

Can you try that and tell me if it works? Change (setq LOGP (strcat "\\\\Server\\Folder\\" xxx )) for (setq LOGP (strcat "\\\\Server\\Folder\\" xxx "\\"))

Posted

Hi ronjonp and Jef!,

 

It works!

 

(if

(findfile (setq LPath (strcat "\\\\SERVER\\FOLDER\\" (getvar 'loginname) "\\")))

(setvar "LOGFILEPATH" LPath)

; (print (strcat LPath " not found..."))

(setvar "LOGFILEPATH" (strcat "c:\\users\\" (getvar 'loginname) "\\appdata\\local\\temp\\")) ;default path

)

 

There was only the "\\" missing.

 

Thank you guys!!!

 

kind regards

Bluebird1973

Posted
Hi ronjonp and Jef!,

 

It works!

 

 

 

There was only the "\\" missing.

 

Thank you guys!!!

 

kind regards

Bluebird1973

 

Strange .. either path works for me? BTW ... you could shorten the temp path to: (setvar 'logfilepath (getenv "temp"))

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...