Jump to content

Recommended Posts

Posted

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")

 

 

image.thumb.png.792f4da82c91af82b7ea932163697653.png

 

 

 

 

Posted

Don't you mean :

 

(strcat "\\company.lan\center" (substr (getvar "DWGPREFIX") 1 2))

 

Posted
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?

Posted (edited)
(if (vl-string-search "P:\\" (getvar "DWGPREFIX"))
 (strcat "\\\\company.lan\\center" (substr (getvar "DWGPREFIX") 3 (strlen (getvar "DWGPREFIX"))))
)

 

 

Edited by confutatis
Posted
(if (= (substr (getvar 'dwgprefix) 1 2) "P:")
  (strcat "\\company.lan\center" (substr (getvar "DWGPREFIX") 3))
)

Not sure, though...

Posted (edited)

The path would always have something a start re drive ? If not P: then what ?

 

 

Edited by BIGAL
Posted (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 by ronjonp
  • Like 1
Posted
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.

Posted
59 minutes ago, Manuel_Kunde said:

 

It works, thank you so far.

I had a typo changed above.

  • Like 1

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...