Retrieve Partial Filename

Retrieve Partial Filename

michael.leeVP72S
Participant Participant
2,176 Views
3 Replies
Message 1 of 4

Retrieve Partial Filename

michael.leeVP72S
Participant
Participant

I am creating a drawing title block which includes a box for project name.  Been doing some research and apparently you can use DIESEL expressions to extract a string of text from the filename to do this.  But not sure how to do it exactly as the examples I seen are not suited to my case.

 

In my case filename and path is in the following format X:\xxxxx yyyyyy\...\drawing.dwg.  xxxxx is always a five digit project number and yyyyyy is the project name which is a combination of numbers and letters with the number of characters changing.  I want to extract the yyyyyy part of the filename and put into the title block and refresh automatically.  I was thinking perhaps you can use the "\" character after YYYYYYY to determine the end of the project name.  Can someone kindly let me know what is the DIESEL expression for this?  Many thanks.

0 Likes
2,177 Views
3 Replies
Replies (3)
Message 2 of 4

imadHabash
Mentor
Mentor

Hi,

i think that - as much as i understand - you can by FIELD command do that . 

 

cap.jpg

Imad Habash

EESignature

0 Likes
Message 3 of 4

michael.leeVP72S
Participant
Participant

Hi Imad,

Using FIELD command does not help as it returns either the filename or the path name or a combination of both with or without file extension.  I only need a partial string of the the path name.  Cheers.

0 Likes
Message 4 of 4

pendean
Community Legend
Community Legend
Editing Diesel expressions is covered in HELP, here are some examples (not exactly what you want but its enough to get you started) https://forums.autodesk.com/t5/autocad-forum/editing-autocad-field-expression-or-diesel-expression-e...
and https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/diesel-expression-part-of-file-name/...

HTH