Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Click OK button to continue printing

EddyVE

New member
I have a mapkey defined for printing drawings.

I use the Windows Print Manager.

When I use the printing mapkey, the Windows printing dialog box is opened to select a printer.

I have to click the OK button to continue printing. I can't find a way
to make the mapkey print automatically without me having to click the
OK button (or press ENTER).



I have tried by defining a .pcf file.

In this file I have entered:

plotter_command windows_print_manager \\PRINTERS\PDF-Writer



In config.pro I have added

pro_plot_config_dir and this points to the directory where my .pcf file is located.



But Pro/E still behaves the same. I still have to click the OK button before printing continues ...



For normal printing this is not a huge problem, but I tried to use
Spekan's sBatch tool for batch plotting and it does not work because of
this.



Does anybody know a way?



Kind regards
 
Have you changed your mapkey to select the new .pcf configured printer? My mapkey looks like this for printing PDFs.


mapkey pdf @MAPKEY_LABELPDF Output;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;~ Activate `main_dlg_cur` `File.psh_print`;\
mapkey(continued) ~ Select `print` `CascadeButton1`;~ Close `print` `CascadeButton1`;\
mapkey(continued) ~ Activate `print` `MorePrinter`;\
mapkey(continued) ~ Select `generic_list` `Selections`1 `PDF Output`;\
mapkey(continued) ~ Activate `generic_list` `OK`;~ Activate `print` `OK`;\
mapkey(continued) ~ Activate `Print_file` `OK`;


<tg>
 
As soon as you get to the Windows Print dialog box Pro/E no longer has any control over it because it's the OS that puts that up. Your mapkey won't be able to do anything with the dialog box.


The best solution is to use Pro/E's built in plot drivers so you don't need to use the MS Print Manager. You could then just change your plotter_command to send the created file to the printer using lpr or copy or whatever method you choose.


However, there are times when Pro/E doesn't have a built-in driver that works for you. In this case you need to use the MS Print Manager in order to correctly create the output. Then you run into the "OK" button issue which is fine for manual plotting but for batch plotting it causes problems. I have successfully worked around this problem in the past by creating my own external program that will push OK for me. My mapkey just starts the external app that "listens" for the print dialog box, then it creates the plot (just as yours would) and when the OK button appears the external app presses OK and then exits. It's kind of cheesy but it works.
 
tg,

Thanks for your input, but I still seem to end up with the printer dialog box ...:(



bruppert,

I was just preparing to take that same route. Seems like the most comfortable alternative in the end.

I have done it before with 2000i2. I used AutoIt (
http://www.autoitscript.com/ ) to create scripts and put these 'under'
icons in my Windows taskbar.

To call these scripts from a sBatch batch file I will need to assign these external scripts to a mapkey.

I'll have to look into that. Don't think I done that before....



[Added]

Seems like I have done that before ...
smiley1.gif


"Tools / Mapkeys / OS Script"

[/Added]



Kind regards







Edited by: EddyVE
 
Darn, seems like I'm stuck. The AutoIt script in itself
works fine, but when I try to execute it via a mapkey, the 'cmd.exe'
console window appears and this freezes the WildFire window, so the
AutoIt script commands can not reach WildFire ...
smiley19.gif




Looks like I'm back to square one ....



Kind regards



Edited by: EddyVE
 
I re-read brupperts post and now I am doing a similar trick:

I created an AutoIt script that I am running stand-alone in the background.

This script simply waits 'forever' until it 'sees' the Windows printer
dialog box. Then it sends an ENTER keystroke to that dialog box (same
as pressing the OK button).



So when I execute my 'print' mapkey, the external script makes sure that the OK button is pressed.



The nice thing is that by making my LaserJet or my PDF-writer the
Windows default printer, I can select between a paper hardcopy or a pdf
file.



It works for me ....
smiley1.gif




Kind regards

Eddy
 
EddyVE:


I was in the process of adding this comment when I saw you solved your problembut I'll add it justin caseyou want to get the other method working:


Try changing the mapkey system command and use a "start" prefix instead of just running the executable. That way Pro/E shouldn't be "hung" while the external command executes.


For example: OS command in mapkey "notepad" by itself will start notepad but Pro/E will be frozen until notepad is closed.


OS command "start notepad" will start notepad but return back to Pro/E while notepad is open so your script can continue.
 
bruppert,

That's exactly the answer I was looking for yesterday evening !!
smiley20.gif


I was hoping there would be a way to execute an external application 'asynchronously' instead of 'synchronously' as I was doing.

But try to find an answer in the Pro/E helpfiles ...
smiley5.gif




Thanks a million !!



Kind regards

Eddy
 
How does one create a script file (this is new to me)? I too would like to bypass Windows Print Manager, but since our printers are not supported by PTC, I need a workaround.





"I created an AutoIt script that I am running stand-alone in the background.
This script simply waits 'forever' until it 'sees' the Windows printer dialog box. Then it sends an ENTER keystroke to that dialog box (same as pressing the OK button).

So when I execute my 'print' mapkey, the external script makes sure that the OK button is pressed."
 
Cam721,

I use AutoIt (
http://www.autoitscript.com/ ) to create scripts.
AutoIt is a tool that was originally created to do fully automatic installs of any kind of software. But you can use AutoIt to control almost any program and it has a lot of uses.
You could say that its basic functionality is to replace the users mouseclicks and keystrokes by a script, i.e. to do it 'automatically'.

If you want to get in to AutoIt, download it from the above site and take a peek at the helpfile.
There are 3rd party tools for AutoIt that can help to create scripts . Then it is like creating mapkeys in Pro/E: anything you do when the 'recorder' is on, is registered and stored in a script.

A good tool is SciTe. It is a (script) editor and it has another tool embedded called Au3Recorder. This is the recording tool that you can start from within SciTe.
Once you start with something simple it is pretty straigtforward.

I will post the script I use for pressing the printer OK button soon. Right now I am not on my work pc.

Kind regards
Eddy


Edited by: EddyVE
 
Were using the plotter command to set the drawing as a postscipt file to the printer. Using the LPR command (WINDOWS HELP) will allow yur software to print to printer/plotter.

If you use windows print manager, you WILL ALWAYS get the print dialogue box. Search on the knowledge base(PTC) for printing. There is several documents that helps you set up your printing.

We've created a pcf file that can print to printer directly. Then made a mapkey for that.

Then to round it off we places an Icon with config.win for this mapkey. Now we click on icon and the paper falls out. monkey see monkey do.
 
Marius,



Thanks for your suggestion but I did not have much luck with using pcf
files the other day. But I probably did something wrong...



Anyway, the workaround I'm using now seems to do the job.



I have attached the AutoIt script (see link below) that 'pushes' the OK button on the Windows Print Manager dialog box.



Save the file giving it an .au3 file extension. When you have AutoIt installed, double-clicking the file will execute it.

It will run silently in the background in an endless loop. So you must
terminate it manually using its Taskbar icon. Or you can simply leave
it running until you shutdown your pc.



Note: when you have a non-English Windows version, you must change the
(English) window titles in the script according to your language.



Kind regards

Eddy




2006-01-22_151303_PressPrinterOKButton.zip
 
EddyVE

It is OK if you got it to work. The problem is that what if you got, lets say 10 machines to maintain. Youlle have to go and set it up on every machine. Or when ever you buy a new PC.

I'm a lazy person and always look for the easiest way of doing things. For instance, when we buy a new PC for the office, I don't install PROE on it. I just copy the PROE folder over the network to the new PC and run ptc setup.

Here is and example of our current pcf file:
plotter POSTSCRIPT
button_name PS_A3_Current_sheet
button_help Print to PS_A3_Current_sheet
plot_drawing_format YES default
plot_segmented NO default
plot_roll_media NO default
plot_handshake NO default
plot_label NO default
create_separate_files NO default
plot_with_panzoom YES default
allow_file_naming YES
plot_name YES
interface_quality 3 default
plot_destination printer default
plotter_command lpr -S 10.107.5.171 -P HP8150N
pen_table_file c:\ptc\pro_stds\table.pnt
plot_sheets current
paper_size A3 default
plot_clip NO default
plot_area NO default

The most important thing to look at is the PLOTTER COMMAND.

If your plotter is on the network, point to its ip address, to tell Proe where it is. And then add the printers name. (Make sure there is no spaces in the name).
 
mstols said:
I'm a lazy person and always look for the easiest way of doing things.

I totally support that view!
smiley1.gif




I retried the pcf thing but was not succesful. I wasn't able to setup
the lpr command. Maybe we don't have an lpd server here. I don't know.
I am not an administrator.

I also couldn't find a good printer driver for my printer in Pro/E.



Anyway, since this batch printing thing is only meant for my own comfort, I can live with the 'button clicking' solution.

I'll keep the pcf file possibility in my mind for the next ocasion.



Thanks for your input!



Kind regards

Eddy
 
Marius,



I couldn't resist to give it another try with a pcf file.

Instead of the plotter_command lpr I tried

plotter_command print /D:\\printerserver\laserprinter

and that seems to work like a charm!



Since I sometimes have to create pdf-files by 'printing' to
'pdf-creator' that is setup as a normal Windows printer, I made 2 pcf
files.

I have created 2 mapkeys: one to print to the laserprinter and one to print to the pdf creator.



I think what I did wrong the other day was that I did not include the

plotter POSTSCRIPT

line in my pcf file. I used some other name.



Here is the pcf file I use now:



plotter POSTSCRIPT

button_name LaserJet

button_help Print pcf to LaserJet.

plot_drawing_format YES default

plot_segmented NO default

plot_roll_media NO default

plot_label NO default

plot_handshake software default

create_separate_files NO default

plot_with_panzoom NO default

rotate_plotting NO default

allow_file_naming YES

plot_name NO

interface_quality 3 default

plot_destination file default

pen_table_file table.pnt

plot_sheets current default

paper_size A4 default

paper_outline NO default

plot_clip NO default

plot_area NO default

plot_destination printer default

plotter_command print /D:\\printerserver\LaserJet



Thanks again!



Kind regards
 

Sponsor

Articles From 3DCAD World

Back
Top