 Vishi Anand
		
			Vishi Anand
		
		
		
		
		
		
		
		
	
			01-10-2003 10:36 AM
 
					
				
		
 RobertoBozzolo
		
			RobertoBozzolo
		
		
		
		
		
		
		
		
	
			01-11-2003 01:22 AM
01-13-2003 10:36 AM
 
					
				
		
 RobertoBozzolo
		
			RobertoBozzolo
		
		
		
		
		
		
		
		
	
			01-13-2003 04:39 PM
01-14-2003 10:06 AM
01-14-2003 09:06 PM
01-15-2003 10:36 AM
 highbran
		
			highbran
		
		
		
		
		
		
		
		
	
			04-19-2018 04:38 PM
Hi Roberto,
I am trying to read the output from a command line EXE using system() or LaunchExecutableEx(), but I haven't been able to.
Normally in cmd I would send the following:
C:\TestTool\TestTool.exe enter
And the response I get is:
PASS
From cmd I can add "|clip" to copy the response to the Clipboard, like this:
C:\TestTool\TestTool.exe enter |clip
Now I don't see a response in the console, but "PASS" is in the Clipboard and I can paste it.
I can also do what you suggested in this topic:
C:\TestTool\TestTool.exe enter > output.txt
And the response will appear in C:\TestTool\output.txt
The problem is that when I use system() or LaunchExecutableEx() in my CVI application I don't get the response.
system("C:\TestTool\TestTool.exe enter |clip");
system("C:\TestTool\TestTool.exe enter > output.txt");
LaunchExecutableEx("C:\TestTool\TestTool.exe enter |clip", gWindowState, &gExeHndl);
LaunchExecutableEx("C:\TestTool\TestTool.exe enter > output.txt", gWindowState, &gExeHndl);
Any clue?
 
					
				
		
 RobertoBozzolo
		
			RobertoBozzolo
		
		
		
		
		
		
		
		
	
			04-20-2018 01:54 AM - edited 04-20-2018 01:55 AM
Well, this works for me with a OS shell command. It is not guaranteed it works with your program as well, but you can easily see if '| clip' keyword works by lanching the program interactively and pasting output (if any) to notepad.
int CVICALLBACK test (int panel, int control, int event,
					  void *callbackData, int eventData1, int eventData2)
{
	char	*msg = NULL;
	if (event != EVENT_COMMIT) return 0;
	system ("cmd /c dir | clip");
	ClipboardGetText (&msg, NULL);
	if (msg)
		MessagePopup ("Clipboard", msg);
	else
		MessagePopup ("Clipboard", "No text was available");
	if (msg) free (msg);
	return 0;
}
 highbran
		
			highbran
		
		
		
		
		
		
		
		
	
			04-20-2018 11:46 AM
Hi Roberto,
Thanks much for your quick response.
I had to do a batch file to make it work, i. e.:
system("C:\TestTool\TestTool_Enter.bat");
And this is the content of the batch file.
C:\TestTool\TestTool.exe enter |clip
Thank you,
JIBRAN