I've noticed that when you export a layout to PDF in Pro, it gives you a handy option to "View exported file." Is there a way to add this prompt for a file generated from a Python toolbox?
You could set a boolean parameter named 'View exported file' in your tool, and then at the end of your script you set a conditional that checks if the boolean is true or false and do an os.startfile('exported path') if its true.
Yikes! My bad on that one- thanks for catching it. I had C#'s File.Open stuck on the brain for opening files.
I updated the post with your correction.
This did the trick! Thanks. I found os.open() didn't seem to work, but os.startfile() did what I needed instead.
# Open the PDF if the user wanted toif parameters[2].valueAsText == "true":os.startfile(pdfFile)
I've tried adding links via AddMessage and SetProgressorLabel, but the resulting link isn't a "live" hyperlink, whether to a URL or a file.
Getting a "completion" message to show up is probably something that would need to be done via the Pro SDK, rather than from a Python script. It would be a really great feature, though!
they aren't part of a tools parameeters
Layout—ArcGIS Pro | Documentation
exportToPNG (out_png, {resolution}, {color_mode}, {transparent_background}, {embed_color_profile}, {clip_to_elements})
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.