Manuel_Kunde Posted July 6, 2021 Share Posted July 6, 2021 Hi, I want to change the beginning of my path (the workingfolder) if the path starts with "P:\" (marked red) and replace it with the path marked green. (with an if - function). (The destination location is the same, but the access is through a different network). Is it possible to change the beginning with an If - function and change the Path this way? (strcat (substr (getvar "DWGPREFIX") 1 2) "\\company.lan\center") Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted July 6, 2021 Share Posted July 6, 2021 Don't you mean : (strcat "\\company.lan\center" (substr (getvar "DWGPREFIX") 1 2)) Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted July 6, 2021 Author Share Posted July 6, 2021 5 minutes ago, marko_ribar said: Don't you mean : (strcat "\\company.lan\center" (substr (getvar "DWGPREFIX") 1 2)) Yes, exactly. Do you know of an If function that will only execute the Stract command if "P:" is at the beginning of the path? Quote Link to comment Share on other sites More sharing options...
confutatis Posted July 6, 2021 Share Posted July 6, 2021 (edited) (if (vl-string-search "P:\\" (getvar "DWGPREFIX")) (strcat "\\\\company.lan\\center" (substr (getvar "DWGPREFIX") 3 (strlen (getvar "DWGPREFIX")))) ) Edited July 6, 2021 by confutatis Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted July 6, 2021 Share Posted July 6, 2021 (if (= (substr (getvar 'dwgprefix) 1 2) "P:") (strcat "\\company.lan\center" (substr (getvar "DWGPREFIX") 3)) ) Not sure, though... Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 7, 2021 Share Posted July 7, 2021 (edited) The path would always have something a start re drive ? If not P: then what ? Edited July 7, 2021 by BIGAL Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 7, 2021 Share Posted July 7, 2021 (edited) On 7/6/2021 at 6:49 AM, Manuel_Kunde said: Yes, exactly. Do you know of an If function that will only execute the Stract command if "P:" is at the beginning of the path? Sounds like you have people accessing files through UNC ? If so perhaps: (if (wcmatch (setq dp (getvar "DWGPREFIX")) "P:*") (strcat "\\\\company.lan\\center" (substr dp 3)) dp ) *EDIT Changed (substr dp 1 2) to (substr dp 3) Edited July 7, 2021 by ronjonp 1 Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted July 7, 2021 Author Share Posted July 7, 2021 8 hours ago, ronjonp said: Sounds like you have people accessing files through UNC ? If so perhaps: (if (wcmatch (setq dp (getvar "DWGPREFIX")) "P:*") (strcat "\\\\company.lan\\center" (substr dp 1 2)) dp ) It works, thank you so far. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 7, 2021 Share Posted July 7, 2021 59 minutes ago, Manuel_Kunde said: It works, thank you so far. I had a typo changed above. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.