Is there a possible way to alter the <dyn type="project" property="path"/> to somehow remove the first 2 characters it displays?
When I use Path for Dynamic Text it displays it as an example as:
T:\TestDrive\Project\Maplocation
What I want is the path to not show the "T:" and only display \TestDrive\Project\Maplocation
Is that possible at all? In our organization we have different drives by user so the Drive Letter can get confusing depending on how people have it mapped. We have a more standard naming convention we use that I can add in before the Path which I would use instead of having the drive letter...
Hi Pete,
There is nothing "out-of-the-box" that I'm aware of that you can use to parse dynamic text.
However, I believe you can use ArcPy.mp to do this. I'm in no way an expert in Python, but hopefully the following can at least get you started.
1. Get the path from the project
See: ArcGISProject—ArcPy | Documentation
2. Parse the string
See: How to split a dos path into its components in Python - Stack Overflow
3. Pass it into a text element on the layout
See: TextElement—ArcPy | Documentation
4. Create GP script with this code to be reused with other documents since this script would need to be run for each individual document and anytime the documents was moved to a different file location.
Here's a link to a series of ArcPy samples for both ArcMap (arcpy.mapping) and ArcGIS Pro (arcpy.mp) that may is a good resource - https://www.arcgis.com/home/group.html?sortField=modified&sortOrder=desc&id=398a345905c845e38229c15f....
Hope this helps,
Tom
Here's a sample of how the code might look:
Hey Tom,
I think maybe that is the only way to do something like this then. Like you, I haven't done a lot in Python at all and I was hoping I could just do something within the text box itself, but maybe as you stated it might have to be done externally instead and then added into the Text Box somehow. I'll have to take a look at the links and such then and see if I can get that to work. Thanks...
Even if the samples don't do exactly what you want they do provide good insight on how you can use Python.
Good luck, Pete.
Yeah, it's going to take some work to go through your suggestion on how to do this. I just wish it would have been easier to just strip off text in the actual text box, or even alter what the PATH function shows a bit easier. Decades ago, I used old BASH commands to do this which was kind of easy...
Pete, here is a link to the Python help regarding script tools (step 4) - What is a script tool?—Geoprocessing and Python | Documentation
I've actually taken the ArcPy course for Pro, it's just that I haven't had a chance yet to start using it yet. I have made some scripts in the past, nothing big, but I'll try and figure this situation out...