With the release of PC-DMIS 2023.1, the Print Command now allows you to edit the file format type in the Edit Window code. This enhancement provides more flexibility to the programmer allowing the use of variables within this versatile command.
Click Here to learn more about our affordable Software Support Packages - the same group that makes these Tech Tips!
In this video, I want to show you an enhancement that was made to the Print Command in version 2023.1. If you're not familiar with the Print Command, it's worth exploring because what it does, is it creates a command in your edit window, which in turn provides greater flexibility in your programming. You can find this command in the menu bar under Insert, Report Command, and Print Command. The change they made in 2023 was to add an argument for output format. This means that you can now see in the code what type of file format the command is set to. Either PDF, RTF, a text file, or a 3D PDF. More importantly, we can now use a variable to control this output. In previous versions, we would need to open the properties of the command and set the file output there.
Let me demonstrate what I mean. You can see my command here. I've actually already inserted a variable in my output format. I could change that back to what it was originally set at. This is what it looks like in 2023. You can see the PDF file type is in the code now. If I mouse over it, you can see I can just change it on the fly to whichever I want.
What I wanted to demonstrate today was the use of a variable there. I'm just going to type in my variable, and I'll show you the associated code that supports that. In my routine, I have an input comment prompting the operator to choose the file type. Either enter a one for RTF, two for PDF, and so forth. What I've done after that input comment is use case commands to assign the value of the variable to correspond with the selection of the operator. Let me demonstrate. I'll run my program, and I'll show you what I mean. So here's the input comment. I'll choose number one for RTF and click okay. You can see in the prompt setting, it's saving as type RTF. So, I'll just cancel that, run it again. Let's go with PDF option two. There again, in the prompt, you can see it's set to that type, PDF.
I'll just do a couple more. Here's the prompt again. I'll do number three for a text file. You can see there, the save as type is set to text. The other thing I've done with my case commands is I've accounted for an invalid input. For example, if I type any key, like a letter or anything, or just the wrong number, say number nine, the operator sees that he's made a mistake, and then we just press OK. It just cycles back to the input comment. This time I'll just pick number four just to show you that this would be a 3D PDF. It just shows PDF, but it would save it as that type of 3D PDF, and that's how it would open.
That's about it. Pretty subtle change but for those of you who use these advanced commands, you will appreciate that subtle change. Now it adds more flexibility. In the past, this was still possible, but I would need to do about four different print commands, and I could still use some code to do that. Now it's just a lot easier. So, it's just one command now with a new argument that allows us to use variables. Okay, so that's it for this tip. I hope you found it useful. Thanks for joining me, and we'll see you next time.