06-24-2009 04:32 PM
Hello All!
I have a ultrasound machine (it's Windows XP based, so treat it as a normal PC), that saves an image everytime I press Ctrl+S. What I try (which i don't know if it's possible) is that for labview to simulate the following step:
1. Key Press of Ctrl+S to save image
2. LabVIEW access the folder which the image is saved, and rename the file to image1.img
3. Switch to the ULtrasound program and press Ctrl+S again
4. Labview access the folder and rename the file to image2.img
5.switch back...and on and on and on.
I think renaming the file is very much doable from my memory (haven't used LabVIEW in a long time), but I'm not sure if the Ctrl+S and switching between programs is doable with LabVIEW.
Thank you all very much for your support! Appreciate it!
Solved! Go to Solution.
06-24-2009 11:22 PM - edited 06-24-2009 11:25 PM
You can send keypresses using the Windows API. Search around as this has come up many times. Look for sendkey or similar. As for the renaming, use the Move function in the File I/O. As for activating the window, again, you would need to use the Windows API. You can get a bunch of utilities here.
EDIT: Another method is to use an automation utility like AutoIt. This has an ActiveX interface which can be called from LabVIEW. I've posted examples on using this, so search for it if you're interested.
06-24-2009 11:22 PM
HI northPIG87,
I can't really relate to your doubt, but i suppose your purpose will be solved by calling another exe(application) and detecting the keys from keyboard.
You can combine bopth the programs if you want.
Regards.
"Appreciate by giving kudos whoever deserves"
06-24-2009 11:25 PM
06-25-2009 01:47 AM
hi shrekt,
Can you post the vi for lv 8.0 please?
06-25-2009 09:41 AM
I'm a tad confused. don't really see how those VIs are helpful. The "Keystroke Detector" VI is just an event structure monitoring keypresses within LabVIEW itself. That doesn't do anything as far as sending Ctrl-S to another program. The "Run Program" VI just uses System Exec to launch an executable. That also doesn't answer any of the questions posed. And the library itself just contains a bunch of Windows API functions that have 2 "Set" functions (SetFileAttributes and SetVolumeLabel), while all the rest are "Get" functions, and none of them even deal with the keyboard.
Just curious: what are these VIs supposed to show?