Brother labelprinter automation problem (Navision crash)

Tom_Taffin
Member Posts: 4
Hi everybody,
Did someone ever tried to link Navision to a Brother QL-580N labelprinter by using the P-Touch / b-PAC SDK automation (also delivered by Brother) ?
Labels are configured in the P-Touch software and the templates are then used for printing data from Navision.
This could be the code:
CREATE(autLabelDocG);
autLabelDocG.Open('c:\item.lbx'); //This is the template created in P-Touch
intIndexG := autLabelDocG.GetTextIndex('Barcode'); //'Barcode' is a text label in the template
autLabelDocG.SetText(intIndexG,'*'+item."No."+'*'); //'Barcode'-text is now replaced by the item number
autLabelDocG.StartPrint('test',0);
autLabelDocG.PrintOut(1,0);
autLabelDocG.EndPrint;
autLabelDocG.Close;
CLEAR(autLabelDocG);
This works fine if I look at the result coming out of the printer, but Navision crashes every time the code runs.
An "internal error"-message appears (without module-no.).
Strange thing is that the error only occurs when the complete code is executed. So I can debug my complete object (with multiple printouts if needed) and during the last step in my debugger the internal error occurs.
The tests were done on Navision 3.70 and NAV2009.
Does anybody have experience with this ?
Thank you very much in advance for your replies.
Tom
Did someone ever tried to link Navision to a Brother QL-580N labelprinter by using the P-Touch / b-PAC SDK automation (also delivered by Brother) ?
Labels are configured in the P-Touch software and the templates are then used for printing data from Navision.
This could be the code:
CREATE(autLabelDocG);
autLabelDocG.Open('c:\item.lbx'); //This is the template created in P-Touch
intIndexG := autLabelDocG.GetTextIndex('Barcode'); //'Barcode' is a text label in the template
autLabelDocG.SetText(intIndexG,'*'+item."No."+'*'); //'Barcode'-text is now replaced by the item number
autLabelDocG.StartPrint('test',0);
autLabelDocG.PrintOut(1,0);
autLabelDocG.EndPrint;
autLabelDocG.Close;
CLEAR(autLabelDocG);
This works fine if I look at the result coming out of the printer, but Navision crashes every time the code runs.
An "internal error"-message appears (without module-no.).
Strange thing is that the error only occurs when the complete code is executed. So I can debug my complete object (with multiple printouts if needed) and during the last step in my debugger the internal error occurs.
The tests were done on Navision 3.70 and NAV2009.
Does anybody have experience with this ?
Thank you very much in advance for your replies.
Tom
0
Comments
-
could you comment out the clear(automation) and see if it still crashes?
turn on the debugger and see at what line it crashes.0 -
Thank you for the reply!
Deleting the CLEAR or close-lines does not solve the problem.
It actually crashes on the last line of the code. So if I add some code now, it will execute everything and crash on the moment that the object is closed.
I tried to simulate 3 print-commands in 1 piece of code. The printer printed 3 labels and navision crashed afterwards.0 -
Tom,
I have experienced a similar thing. It was with the Excel automation. I was able to fix it with the second parameter in the CREATE statement.
Can you try and create your automation with the second parameter of TRUE.
CREATE(autLabelDocG,TRUE);
This will always create a new instance for your automation.
let us know if that worked.
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
can you make the CU single instance?
I'm guessing the print job hasn't finished before you are clearing the variable.0 -
Actually, this sounds like what was happening to the client when I was playing around with making codeunits persistent without making them single instance (successfully that is).
Tom, are you doing anything 'unusual' with the codeunit, the main thing I'm thinking of is passing a copy of a codeunit around and into the codeunit itself. If the last reference to the codeunit goes out of scope while it's being executed the client will crash.
If not then I suppose it's your average corruption problem; if single instancing a link codeunit doesn't work you might try creating an out of process wrapper DLL/EXE. It's slower but at least it cannot crash Navision. Another possibility is to use the VBScript DLL to call your printer DLL, VBScript uses different calling methods that are sometimes more robust against bad DLLs.Robert de Bath
TVision Technology Ltd0 -
Hi Guys,
Thank you very much for your answers. Unfortunately it seems to be impossible to solve the issue directly in Navision.
I created a VBScript to call the printer automation and from Navision I just call the VBScript with a SHELL command.
It's working...but not the most ideal solution :-).0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions