Jump to content

system exec vi to run/stop file depending on conditions


Recommended Posts

Hello


 


I would like to use the system exec vi to run a file and stop the file depending on conditions.


 


I have an exe file written in C# that makes a force feedback joystick to vibrate. I used the command line in exec vi to run the file and it works. Now I to open/close the file depending on the conditions. In the picture, there is a small square box which is where I want the joystick's cursor to be. Whenever the cursor goes outside the box, I want the labview to run the exe file(vibrates joystick). When the cursor comes back inside the box, I want exe file to close(turn off vibration).


 


Is it possible to do this using the system exec vi? If yes, can you guide me through it? I don't know what to do with the error in/out, etc. If no, do you know another way to do this? I tried making a DLL file and using constructor/invoke nodes but one guy told me that I have rewrite the code becaues the all the code is written under one class and I need to separate it into many classes to call each functions in labview. However, I showed the code to C# guy and he told me that I cannot separate the code because it's written as windows form...


 


Thank you!


post-53324-0-20880700-1427701214_thumb.j

Link to comment

 

Hello

 

I would like to use the system exec vi to run a file and stop the file depending on conditions.

 

I have an exe file written in C# that makes a force feedback joystick to vibrate. I used the command line in exec vi to run the file and it works. Now I to open/close the file depending on the conditions. In the picture, there is a small square box which is where I want the joystick's cursor to be. Whenever the cursor goes outside the box, I want the labview to run the exe file(vibrates joystick). When the cursor comes back inside the box, I want exe file to close(turn off vibration).

 

Is it possible to do this using the system exec vi? If yes, can you guide me through it? I don't know what to do with the error in/out, etc. If no, do you know another way to do this? I tried making a DLL file and using constructor/invoke nodes but one guy told me that I have rewrite the code becaues the all the code is written under one class and I need to separate it into many classes to call each functions in labview. However, I showed the code to C# guy and he told me that I cannot separate the code because it's written as windows form...

 

Thank you!

 

 

That very much depends on your C# executable. Is it a simple command line tool which you can run with a command line parameter such as "on" and "off" and will return immediately keeping your force feedback controller running through some other background task? If your executable needs to keep running in order for the force feedback controller to stay on you can not really use System Exec here. 

 

An other idea would be to interface to whatever API your C# application uses directly from LabVIEW. I would assume you use some .Net interface in that C# application to control your force feedback controller so there shouldn't be a big problem in accessing that API from LabVIEW directly and skipping your C# Form application altogether.

 

It is indeed not a good idea to try to interface a .Net Form application to another application through either .Net calls or command line calls, as your Form application is an independent process that wouldn't lend itself to such a synchronous interface as .Net calls or command line calls would impose.

 

If you consider the direct .Net interface to worrisome for some reasons (would be interesting to hear why you think so) another option might be to add an interprocess communication interface to your C# application such as a TCP/IP server interface through which external applications can send commands to your application to control the controller.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.