LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Print file via ActiveX,and it is not found always

That's all the code.

In order to upload the actual VIs I have to create a demo one.

 

What I want to succeed is to print the document after it has been loaded.

So, I include the code of printing, in the VI Ref, getting the Web Browser as the User parameter.

Maybe, I included this code, that is, the Node "IWebBrowser2" with the "OLECMDID_PRINT" parameter in the "cmdID" input, in the wrong place. I want to run it after the Event callback.

0 Kudos
Message 11 of 21
(1,824 Views)

@nikosfs wrote:

That's all the code.

In order to upload the actual VIs I have to create a demo one.


What about the VIs that you actually have. Why can't you upload those? I don't know what you are doing, but simply adding the ExecWB to the "DocumentComplete Callback" VI that I uploaded works just fine for me. You should not be passing the WebBrowser control into the "User Parameters". That is already being passed into the callback VI. Attached is the modified "DocumentComplete Callback" VI.

0 Kudos
Message 12 of 21
(1,818 Views)

Ok! Finally it works. The difference in my code is that after the print, I move the file to another folder. So, it moved the file before it could print it.

I didn't succeed to solve this problem, but if i moved this part of code, in the callback vi, and it now can print it, but without moving the file !! bizzard!

 

Here is the new code:  (The User Parameter is the same Path as the URL input, that is the path to the file to be printed.)

 

Capture11.JPG

 

 

VI Ref:

 

Capture12.JPG

 

 

Now it can print but the code that moves the file to another folder is not working.

0 Kudos
Message 13 of 21
(1,811 Views)

So when you said "That's all the code" what you were really saying was "That's all the code, except for the really important part that's the solution to this problem, but I'm not going to bother showing you because I don't think it's important."

 

Right?

0 Kudos
Message 14 of 21
(1,806 Views)

The code that caused the problem, that is, the file movement to another folder, was in my main code but there are also other parts of code and I could not determine where was the problem.

A small problem remains. Why the file cannot be moved after the print?

If it is easy to find, I would be glad to see a solution.

Thank you.

0 Kudos
Message 15 of 21
(1,801 Views)

Do you get any errors when you try to move the file after it's printed? Do you close references to the file before moving it? You may be running into a resource lock.

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 16 of 21
(1,785 Views)

Thank you for your reply.

I don't get any errors when trying to move the file. Neither do I close references to the file before moving it.

Probably there is a resource lock, because I use the file in the IWebBrowser2 Node, without closing its reference.

I show the "Close File" Function but I don't have a reference of the file to close it. I only use its path. So? What should I do?

0 Kudos
Message 17 of 21
(1,782 Views)

First, make sure you have write permissions for both the file and the directory in which you want to move the file. Next, wire up error handling to the Move and see if it throws an error. That will help us troubleshoot.

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 18 of 21
(1,770 Views)

I wired an error handling, and it doesn't throw any error.

I show again the code:

 

Main VI:

Capture11.JPG

 

VI Ref:

Capture12.JPG

 

 

I just tried to change a boolean value in the second frame, and it does not work. It remains always false.

 

Capture13.JPG

0 Kudos
Message 19 of 21
(1,763 Views)

Run the code in Highlighted mode with Retain values active (the two bulbs close to start arrow) it's great for these things.

It sounds like your ExecWB doesn't finish, which'd mean the vi gets stuck. Is this the case?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 21
(1,756 Views)