Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
In creating a mapkey to save a pdf.
File SaveAs (Alt-F, A)
Type (pick the drop down and chose .pdf)
The file name appears in the File Name box. (e.g. abc123)
Due to quirky things where I work, I need to add a "v" in front of the name (legacy stuff).
I try "Pause for input" add the "v" and resume the mapkey.
Now the mapkey wants to create all the .pdf's with the name of the file when I created the mapkey (e.g. vabc123).
After this I chose the PDF profile and complete the mapkey.
Is there a way to either set the profile with an independent mapkey at the beginning of the Creo session or continue without the filename used when creating the mapkey.
If I could pre-set the PDF profile, I could stop recording the mapkey after the Filename pops up.
This gave me a partial understanding of :Pausing for Input":
https://community.ptc.com/t5/Customization/Pause-for-keyboard-input-in-mapkeys/m-p/419676
Solved! Go to Solution.
This is how our mapkey runs.
File
Save As
Export
PDF is selected in Export Setup
Settings
At the top of the Settings dialog, where it says "Current Profile", use the pull down arrow to change it to your saved profile
Okay button
Export button
After this a window will pop up to name the file. If you want to change the default name like I believe you mentioned in another post, this is where you want to pause the mapkey so you can add the additional text, I think it was a "v" if i remember correctly. Keep the mapkey paused until you enter in the file name and hit the OK button, then resume the mapkey. This will eliminate the problem you have with all your pdf's having the same name.
We don't need to change the name so no pause and the mapkey selects OK here.
After OK above I also added the following to get back to where I started from.
Close Export Setup button
Then the mapkey takes me back to the tab where my PDF export mapkey resides in the UI, this saves a couple clicks.
However, when you save a PDF export profile it should be written as a *.DOP file in the working directory. You should be able to record a mapkey that would load this saved profile as part of the sequence.
See: https://www.ptc.com/en/support/article/CS21152
Also Pro/Batch works with an external profile definition (.dop)
See: https://www.ptc.com/en/support/article/CS33456
From @TomU last post in this article, once set in a session, it becomes the "current setting" and does not need to be selected until a new session of Creo is started. I have verified this. So I just want to run a mapkey to make it the current setting.
https://community.ptc.com/t5/3D-Part-Assembly-Design/export-default-pdf/m-p/175767
Several config options have been added that allow certain PDF export settings to be pre-configured. Depending on what else you need to change, these may be enough to avoid needing to mess with .DOP files.
See my reply to your other thread. You have to keep the mapkey paused until you add the "v" and select the OK button to close the Save As window. Then resume the mapkey.
This is how our mapkey runs.
File
Save As
Export
PDF is selected in Export Setup
Settings
At the top of the Settings dialog, where it says "Current Profile", use the pull down arrow to change it to your saved profile
Okay button
Export button
After this a window will pop up to name the file. If you want to change the default name like I believe you mentioned in another post, this is where you want to pause the mapkey so you can add the additional text, I think it was a "v" if i remember correctly. Keep the mapkey paused until you enter in the file name and hit the OK button, then resume the mapkey. This will eliminate the problem you have with all your pdf's having the same name.
We don't need to change the name so no pause and the mapkey selects OK here.
After OK above I also added the following to get back to where I started from.
Close Export Setup button
Then the mapkey takes me back to the tab where my PDF export mapkey resides in the UI, this saves a couple clicks.
I decided to go back to SaveAs instead of Export. I stopped my mapkey when the filename popped up. Then I can enter the additional characters needed and then hit enter twice without having to mouse. As much with the keyboard as possible..... 🙂
Below is my mapkey:
mapkey gfff @MAPKEY_NAMESave DRW as PDF with corrected filename;\
mapkey(continued) @MAPKEY_LABELSaveAs PDF;~ Select `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdModelSaveAs` ;\
mapkey(continued) ~ Open `file_saveas` `type_option`;~ Close `file_saveas` `type_option`;\
mapkey(continued) ~ Select `file_saveas` `type_option` 1 `db_617`;\
mapkey(continued) ~ Activate `file_saveas` `psh_export_opts`;\
mapkey(continued) ~ Open `intf_profile` `opt_profile`;~ Close `intf_profile` `opt_profile`;\
mapkey(continued) ~ Select `intf_profile` `opt_profile` 1 `GIBRALTAR`;\
mapkey(continued) ~ Activate `intf_profile` `OkPshBtn`;
I'll have to remember that double enter for overwriting existing files. I think I would prefer to do it that way as well.
When I pause it, this window pops up:
Is this when I need to a the "v"? Is doesn't seem to let me add it to the file name line.
I added the "v" there and then hit OK.
Now I have:
That's what you should have. Now you keep on recording your inputs.
In that box you will put instructions if needed to add additional text to the file name. Maybe this?
"Add a "v" to the beginning of the file name and select OK."
The mapkey will pause, prompt the user to add the "v" and when they hit OK, it will resume the mapkey and continue on.
After you enter your text in that box, hit the OK button then there is a Resume Mapkey button somewhere on your screen to continue your keystrokes and selections.
So this is a dialog box that I need to write that I want the operator to add a "v" in front of the name.
Once done, hit the OK button and the mapkey finishes.
Is there a way to add the "v" automatically in front of the name?
Only if the pdf name is the same every time, which it won't be I'm assuming. Pausing the mapkey and adding the "v" is the only way I think you can do what you want to accomplish.
I was able to use Shift+Tab to change the focus of the window to the name field, press Home key to get to beginning and add "v" to the name in a map key.
The mapkey was able to be created that way, but as @mkajdan says, every file in named the same name as when creating the mapkey but with a "v" in front of it.
Hi,
I created mapkey in Creo 4.0
mapkey rr ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdModelSaveAs` ;\
mapkey(continued) ~ Open `file_saveas` `type_option`;~ Close `file_saveas` `type_option`;\
mapkey(continued) ~ Select `file_saveas` `type_option` 1 `db_617`;\
mapkey(continued) ~ Activate `file_saveas` `psh_export_opts`;\
mapkey(continued) ~ Open `intf_profile` `opt_profile`;~ Close `intf_profile` `opt_profile`;\
mapkey(continued) ~ Select `intf_profile` `opt_profile` 1 `myprofile`;\
mapkey(continued) ~ Activate `intf_profile` `OkPshBtn`;@MANUAL_PAUSEModify PDF filename;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Activate `intf_profile` `OkPshBtn`;
See creation procedure in mapkey.mp4 video.
Thanks Martin.
Similar by different from what @mkajdan suggested.
I was just trying to figure out if there was a way to automatically add the "v" in front of the filename, but from what I gather, there is not.
@Dale_Rosema wrote:
Thanks Martin.
Similar by different from what @mkajdan suggested.
I was just trying to figure out if there was a way to automatically add the "v" in front of the filename, but from what I gather, there is not.
Hi,
I guess that mapkey functionality does not enable you to automatically add the "v" in front of the filename.
I can imagine being able to run my Creo mapkey with AutoIt and then add the letter v in the AutoIt script. But I don't really want to try...
🤣😂 " But I don't really want to try... " 🤣😂
I didn't have time to do much testing yesterday because it was at the end of the day. I spent some time trying different things this morning without pausing the mapkey and I'm running into the same issue you are with everything having the same file name.
The idea from @kdirth looked promising yesterday but I got the same result you did.
I tried doing a drawing rename when the Save As window pops up, copied the drawing name, cancel the rename, the Save As window pops back up, click in the file name box, Ctrl+A, type the letter v, Ctrl+V then ok. I thought that would work but it's still holding on to whatever file name that was initially recorded in the mapkey. 😡
I'll keep this in mind today and let you know if I can get anything to work without the pause for input.
I don't know if you already noticed this but if the pdf file already exists in the folder, you will need a mouse click in your mapkey to override the old pdf. Otherwise your mapkey will stop when that existing file warning box pops up and your mapkey doesn't acknowledge it.
Hi,
I guess mapkey recording ignores Windows shortcuts CTRL+ACV.
I tried the copy/paste thing yesterday too.
I even double click to make sure it had selected the file name before typing "v" and then pasting.
With your mapkey, if you hit the enter after adding the "v" (and it saves) before resuming, you can resume the mapkey without it failing.
Darn muscle memory is so used to hitting the enter key after adding the "v". (Old mapkey that created a .dwg 🙂 )
Thanks to all who helped understanding the "Pause for Input" function.
Since I cannot automatically add keystrokes at this time, I just truncated the mapkey to end when the input is required so that I could just hit enter twice after making the changes.
Special thanks to:
Hi,
I made a script as part of the AutoIt exercise. See Creo_Save_PDF_2022-08-18_14-11.zip.
The script was tested with Creo 4.0 M140.
save_PDF.mp4 video shows how it works.
Your video looks great.
Can someone point me towards some tutorials/post/videos on AutoIt? (By the way is it Lt or I (eye) t?)
@Dale_Rosema wrote:
Your video looks great.
Can someone point me towards some tutorials/post/videos on AutoIt? (By the way is it Lt or I (eye) t?)
Hi,
AutoIt (eye)
not AutoLt
Simply said AutoIt enables you to "automate" almost any action you are doing manually.
Ask Google ... autoit tutorial ... and you will get useful links.
A lot of complicated things in Creo become straightforward if you use some automation script.
To solve your problem, I would do as follows:
1. Get file name (using script)
2. Using a simple mapkey to export the file to pdf, the pdf file name is the same as the file name (without extension).
3. Locate the pdf file and rename it (using script)
With autohotkey, you can assign the function to a shortcut, eg, press Shift + P and everything is done.