cancel
Showing results for 
Search instead for 
Did you mean: 

Document Printing Automation

Former Member
0 Kudos

Dear All,

Has any one any suggestions on this one... we are trying to automate the printing of documents from B1. For example we are importing an xml file to create a delivery and we would like the delivery to be printed immediately, or we want to release production orders and then print the production orders.

At present it doesnt seem possible to automate this via DI or UI api. Theres nothing in the DI from what weve seen that can support this. We also tried to automate the document printing via UI using command 'SBOApplication1.ActivateMenuItem("520")', it will bring up a Printing option dialog box, but we can't manage to simulate the press of 'OK' button on this dialog box, so it can't be automated without user intervention.

Has anyone encountered this type of problem or found a way to solve this problem.

Thanks in advance.

Dave

Accepted Solutions (1)

Accepted Solutions (1)

AlexGrebennikov
Active Contributor
0 Kudos

Hi!

Have u tried to search forum?

There are a lot of topics on youe issue.

here is one of them:

that should solve your problem

Former Member
0 Kudos

Alexey

Good point... bit still has not helped..

Ok.. we have tested now... and tried the printing with statements below, but it didn't work, got the error message 'The process failed: System.InvalidOperationException:

SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method'.

Also tried SendKeys.SendWait method, then it stops to wait the user click, so also no use.

I believe the examples in SDN is for VB6 code, we are using .NET.

System.Windows.Forms.SendKeys.Send("{TAB 2}")

System.Windows.Forms.SendKeys.Send("{ENTER 2}")

SBOApplication1.ActivateMenuItem("520")

System.Windows.Forms.SendKeys.Send("")

System.Windows.Forms.SendKeys.Send("")

Any ideas ?

Thanks

Dave

AdKerremans
Active Contributor
0 Kudos

Don't use the windows sendkeys, but the sbo sendkeys method, this might help.

It is in de application object.

Former Member
0 Kudos

Alexey

Good point... bit still has not helped..

Ok.. we have tested now... and tried the printing with statements below, but it didn't work, got the error message 'The process failed: System.InvalidOperationException:

SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method'.

Also tried SendKeys.SendWait method, then it stops to wait the user click, so also no use.

I believe the examples in SDN is for VB6 code, we are using .NET.

System.Windows.Forms.SendKeys.Send("{TAB 2}")

System.Windows.Forms.SendKeys.Send("{ENTER 2}")

SBOApplication1.ActivateMenuItem("520")

System.Windows.Forms.SendKeys.Send("")

System.Windows.Forms.SendKeys.Send("")

Any ideas ?

Thanks

Dave

Former Member
0 Kudos

I hate the back button on internet explorer.....

Former Member
0 Kudos

Ad..

Changed to use the SBO sendkeys method, the error message is no more appearing, but it still doesn't work.

The application just wait when the print window appears until user clicks either 'Print/Cancel' button, the the next statement (SendKeys) will run, it won't pass the print window and run the following SendKeys statements.

SBOApplication1.SendKeys("{TAB 100}")

SBOApplication1.SendKeys("{ENTER 100}")

SBOApplication1.ActivateMenuItem("520")

SBOApplication1.SendKeys("")

SBOApplication1.SendKeys("")

We are still hunting ?

Dave

Former Member
0 Kudos

Dear All

It appears we are struggling controlling the windows dialogue box. Control of business one seems to be ok, but once the windows print box is open, we cant control the send key of the 'Enter' to this window.

Has any one experienced this and/or found a solution.

SBOApplication1.SendKeys("{ENTER 100}")

SBOApplication1.ActivateMenuItem("520")

System.Windows.Forms.SendKeys.Send("")

Thanks

Dave

Former Member
0 Kudos

Hello D. Maton,

Are you talking about the window call "Print Preferences", that comes after you choose print. This gives you the option to choose what you want to print, Window or Table? If so, I have tries many ways to bypass the screen but no success. It's not a SAP form. I see your point to code the System.window.sendkey, but we are doing something wrong. Have you found any luck in solving this or can we work together to bypass this window?

Thanks,

L

Former Member
0 Kudos

Laura

We are stuck on the windows print window.

Ive seen a comment on one of the other messages that suggests the sendkeys is not 'recieved' by the system.

Am going to try this.

If I get anything else thats of use will let you know. If you find anything else please comment..

Best wishes

Dave

Former Member
0 Kudos

Dave,

Markus came up with a solution for this:

Juha

Former Member
0 Kudos

hi,

does anybody find a solution of this ?

I now convert my addon from vb6 to vb.net and the solution (link above) don't work anymore.

how can i handle windows messages?

Markus

Answers (0)