LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remotely controlling a VI

Solved!
Go to solution

Hi,

 

I'm building an external video player vi, for my application. Now when i push the "play button" on my main vi, the external video player should start to play. Does anyone knows how to achieve this? I know how to remotely open an external VI, and i could control it with a global variable... but i think there's a better solution.

 

Best regards,

Thijs Boeree

0 Kudos
Message 1 of 7
(2,898 Views)

Hi,

 

I think that you can use the example which is in the link below for your system. Besides I put some more info in the other links that you can read to understand its structure and behavior.

 

Introduction

Sometimes it is desirable to control external programs using a LabVIEW vi.  This can easily be done if the program accepts keyboard shortcuts or custom hot keys can be set to control the program.  In this case playback on an external (not embedded) Windows Media Player is performed with LabVIEW.

 

Steps to Complete

A top-level vi, "Controlling WMP Window.vi," handles the user interface.  The vi opens a media file in an external Windows Media Player window.  The program then uses a sub-vi, "Find Window.vi," to obtain a handle for the window.  A handle is actually a Windows data type (see Windows Data Types for more information).  When playback controls are pressed, the program sends the keystroke command to the Windows Media Player window using "SendKey.vi."  When the main vi is exited, the ALT-F4 key combination is sent to close Windows Media Player.

 

Additional Notes

A media file must be selected before the vi is run.

This example can be adapted for any program accepting keyboard shortcuts.  The program should be opened using an Active X reference or the System Exec VI (see "System Exec VI" in LabVIEW Help). The window name input for the "Find Window.vi" must also be updated.

 

http://en.wikipedia.org/wiki/Activex

 

Hope these will help.

 

Regards,

Hossein

 

 

0 Kudos
Message 2 of 7
(2,877 Views)

Thank you,

 

But i think i need something else, i also need to control the slider, i can do that with the IWPM controls -> currentPosition, so i think i need "call by reference VI" only now my external VI won't start...

 

Regards,

Thijs Boeree

0 Kudos
Message 3 of 7
(2,868 Views)

Hi Thijs,

 

Thanks for your feedback and sorry that my suggestion didn't help you. Can you give me your vi to reproduce it in my system,?

Besides did you use another vi to see if you can run it remotely ?

 

Hear from you.

 

Regards,

Hossein

0 Kudos
Message 4 of 7
(2,834 Views)

My vi is very big and complicated now (see attachment)... I almost got my thing to work, but not quite right!

 

This is what i have:

 

Main VI with a cluster with all my control references (front panel controls) stored in a type def in this control cluster are also:

"Play button"

"Pause button" 

"X position"

 

Then i have a:

 

Video_Player VI with a windows media player, and it has an event loop with dynamic events (registered events from the control references cluster from the Main VI)

 

Now when i have my Video_Player VI in my main VI it starts up but it doesn't run indepentently? So i have to close my Video_Player VI to gain control over my Main VI again? And i have selected at the "SubVI Node Setup: Show front panel when called...

 

Regards,

Thijs

0 Kudos
Message 5 of 7
(2,810 Views)
Solution
Accepted by topic author ThijsBoeree

Hi,

 

Could you send me a .bdf file which I can use it in your code?

Because I didn't find anything wrong in your code.

 

Thanks,

Hossien

0 Kudos
Message 6 of 7
(2,753 Views)

I already got it working, i had to put the dynamic event registration outside of the loop...

 

Best regards!

Thijs

0 Kudos
Message 7 of 7
(2,749 Views)