MikaelH Posted February 10, 2012 Report Share Posted February 10, 2012 Hi Guys Sorry for using such a bad word as LabWindows here on LAVA, but I have a development team in Fremont and Shanghai that develop all their code in LabWindows. Since you can't do all cool stuff there I had to write the intelligent code in LabVIEW, and have them to call my LV exe file. I let them control the behaviour to my exe file with arguments so they can call it like this: MES_Finish.exe --PreCure or MES_Finish.exe –PostCure But the developers say that LabWindows can't call exe files with arguments. Does anybody know if this is true? A work around that didn't work either, was for them to call 2 batch files with the argument syntax in. Cheers, Mike Quote Link to comment
asbo Posted February 10, 2012 Report Share Posted February 10, 2012 I haven't used LabWindows, so I can't answer your first question, but I don't understand why the batch file wouldn't work... Quote Link to comment
MikaelH Posted February 10, 2012 Author Report Share Posted February 10, 2012 It could be that the devlopers are senior enough... Quote Link to comment
candidus Posted February 10, 2012 Report Share Posted February 10, 2012 Here is a quote from the CVi documentation: LaunchExecutable int LaunchExecutable (char filename[]); Purpose Starts running a program and returns without waiting for the program to exit. Note If you want to wait for the program to exit, use the system function in the ANSI C Library. The program must be an actual executable; that is, you cannot launch commands intrinsic to a command interpreter. The executable can be either a DOS or Windows executable, including *.exe, *.com, *.bat, and *.pif files. .exe, .com, and .bat DOS programs use the settings in _default.pif (in the Windows directory) when running. You can change their priority, display options, and so on., by editing _default.pif or by creating another .pif file. Refer to www.msdn.com for information about creating and editing .pif files. If you need to execute a command built into command.com such as copy, dir, and others, you can call LaunchExecutable with the following command: command.com /C DosCommand args where DosCommand is the shell command you want to execute. For example, the following command string copies file.tmp from the temp directory to the tmp directory: command.com /C copy c:\\temp\\file.tmp c:\\tmp Note If you want to monitor whether the launched executable has terminated, use LaunchExecutableEx. In other words: It should work... 1 Quote Link to comment
viSci Posted February 10, 2012 Report Share Posted February 10, 2012 Could you compile your LV code to a DLL? Quote Link to comment
asbo Posted February 10, 2012 Report Share Posted February 10, 2012 In other words: It should work... Sounds like the LW developers are full or malarkey, then... Quote Link to comment
MikaelH Posted February 10, 2012 Author Report Share Posted February 10, 2012 Thanks, so maybe this command would work: command.com /C Myexefile.exe -- arguments And why not, I can create a DLL also...or convince them to migrate to a real programing language ;-) Quote Link to comment
candidus Posted February 13, 2012 Report Share Posted February 13, 2012 It definitely works. I played around with the different LW API functions. You can even use the system() function that is part of the ANSI C library. My example command was: char *cmd="cmd /k echo \"Hello world\""; Here are the options: // Does not wait for the executable to finish. LaunchExecutable(cmd); // Waits for the executable to finish. Even part of the ANSI C standard. system(cmd); // Runs the executable... int procHandle = 0; LaunchExecutableEx(cmd, LE_SHOWNORMAL, &procHandle); // .. and enters a loop (timing 0.1s) that waits for the executable to finish. while(!ExecutableHasTerminated(procHandle)) { Delay(0.1); } There's really no problem here, perhaps there was one years ago in the stone age of programming, I have no clue :-) And why not, I can create a DLL also...or convince them to migrate to a real programing language ;-) That may be an even better idea ;-) 1 Quote Link to comment
MikaelH Posted February 14, 2012 Author Report Share Posted February 14, 2012 Thank you Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.