cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Mapkey PDF export into specific directory

Adam13
6-Contributor

Mapkey PDF export into specific directory

I've been trying to create a mapkey which uses the File->Save As->Export to export a pdf file. I then want the export dialog to automatically take you into a specific subfolder within the working directory, where you then can name and export the pdf into. I've gotten this to work with the following mapkey: 

 

mapkey pdf @MAPKEY_NAMESave PDF file;@MAPKEY_LABELSave PDF file;\
mapkey(continued) ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdExportPreview` ;\
mapkey(continued) ~ Command `ProCmdDwgPubSettings` ;\
mapkey(continued) ~ Select `intf_profile` `pdf_export.PDFMainTab` 1 `pdf_export.PDFContent`;\
mapkey(continued) ~ Select `intf_profile` `pdf_export.pdf_font_stroke` 1 `pdf_stroke_all`;\
mapkey(continued) ~ Activate `intf_profile` `pdf_export.pdf_searchable_text` 0;\
mapkey(continued) ~ Activate `intf_profile` `OkPshBtn`;~ Command `ProCmdDwgPubExport`;\
mapkey(continued) ~ Select `file_saveas` `ph_list.Filelist` 1 `FOLDER_A`;\
mapkey(continued) ~ Activate `file_saveas` `ph_list.Filelist` 1 `FOLDER_A`;

 

The problem is when the folder doesn't exist (we use a certain folder structure where this folder is created for new projects, but for old ones it might not be there), Creo then exports the pdf into the working directory without asking any questions about the file name. This is a problem. I want to be able to name the file before exporting even when the specified folder isn't there. So when "FOLDER_A" isn't a subfolder in the working directory, the pdf export dialog should be located in the working directory but with the ability to name before exporting.

 

Is there a way to get Creo to show the dialog box and name the pdf when the folder specified in the mapkey isn't there?

4 REPLIES 4

You could use the Pause option, to enter the file name, when recording the mapkey just before saving the pdf.

Adam13
6-Contributor
(To:manjunathrv)

That would probably solve it, yes. But is there a way to do it without the pause option? I find it unreliable since users can bypass that dialog by mistake. 

dgschaefer
21-Topaz II
(To:Adam13)

I'd add a call to a batch file that creates the folder if it doesn't exist. We use batch files within mapkeys to process exported files and create directories in the process.

 

A system window opened from Creo opens in the current working directory, so a simple "MD FOLDER_A" in a batch file should create FOLDER_A in your current working directory, if it does not exist.  If the directory already exists, it proceeds without error.

 

When recording your mapkey, you need to search for the "Open System Window" command as it's not in the ribbon.  You can also manually edit the mapkey in a text editor to add the call to a batch file.

 

This mapkey from our Creo 2 config calls a batch file (ceex_temp_dir.bat), calls another general export mapkey (EX5) and then calls a batch file (ceex_pdf.bat) to process the export:

 

mapkey ds3 @MAPKEY_LABELFull PDF;\
mapkey(continued) @SYSTEM$creo_lib\\config\\00_concept_engineering\\export\\ceex_temp_dir;%EX5;\
mapkey(continued) @SYSTEM$creo_lib\\config\\00_concept_engineering\\export\\ceex_pdf;\
mapkey(continued) @MANUAL_PAUSEYour PDF file is now in your temporary folder, in a sub-folder \
mapkey(continued) marked with today's date.\n\nThank you.;

Note the use of a system variable, $creo_lib, that's defined in our launch script to the root of our Creo library, also the double backslashes and that the extension for the batch file isn't required.

 

Edit:  Thinking more, I'm not sure that you can add the call to a batch file entirely while recording the mapkey.  I'm not certain that anything you type in the system window (navigating and executing the batch file) would be recorded in the mapkey.  I'm actually fairly certain it won't, so you'll probably need to add it manually.  It's been a while since I set this up so I don't quite remember. 

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
Adam13
6-Contributor
(To:dgschaefer)

This is slighly above my skill set at the moment. I was hoping there was a way to do this without having to create .bat files. But I'll try to do as you instructed when I get some time. Thanks for the advice!

Top Tags