Labview System Exec VI different results than command window - labview

When I try to run my executable (.exe) from the command window it works fine, but nothing happens when using the same commands in LabView's system exec VI. What do I need to change in my labview program?
I have tried calling the executable directly from the VI's command line, and have tried adjusting/deleting the working directory. I have not been able to start the .exe successfully yet.

You use "standard input" parameter in an incorrect way. Try this:

Related

Labview Vi's exe File not working via Python script

I made an exe file of labview project. The vi has a loop for a limited time and vi closes as the loop ends. When I open the exe file by double clicking, the vi opens and runs properly. BUT, if i try to run the exe file using Python script as below, the vi opens and stops at once and loop is not completed.
I have tried multiple python commands to run it, but nothing works. Hope someone knows the solution.
This is the code
import sys
import os
os.system("C:\\Users\\sjaved\\Desktop\\Pwm_MPC5748G_MT\\BSWs\\MCAL\\Pwm_MPC5748G\\targetTest\\NIPXI\\builds\\NI_Opponent\\Host\\Host.exe")
Some older versions of LabVIEW required the "Run when opened" option to be set in your top level VI's Execution preferences in order to auto-run when the app is executed. I tested this with a LabVIEW 2017 exe and python and the VI ran as expected (even without the "Run when opened" property set).

mem_test.bat file does not execute

I am in the middle of designing a schematic in Xilinx ISE 14.7 core generator and I've run into a little problem which I need help with. I need to run mem_edit.bat file in order to run the memory editor application and create a .coe file. Whenever I run the file, command prompt just flashes on the screen without running the commands. How do I run mem_edit.bat to be able to run memory test. I have run the file in a static command prompt session and inserted a pause in the code to no avail. I have also run the commands directly in command prompt and still no success. Please help me as I am on a timeline and I need to finish this fast. I am running on a 64 bit windows10 machine. I am kinda new to Xilinx ISE so please go a bit easy on me. The contents of mem_edit.bat have been quoted below
#echo off
REM Script to launch Xilinx memory editor
set CLASSPATH=
set JAVA_HOME=
"%XILINX%\java\nt64\jre\bin\java" -DXILINX="%XILINX%" -DMYXILINX="%MYXILINX%" -cp "%XILINX%\coregen\lib\encore.jar;%XILINX%\coregen\lib\coreutil.jar;%XILINX%\coregen\lib\sim.jar;%XILINX%\coregen\lib\xcc.jar;%XILINX%\coregen\lib;%XILINX%\coregen\resources" com.xilinx.iputils.memory.editor.CoreGen2RunMemoryEditor 2> NUL
I have managed to solve the issue. I happened to stumble on the directory where the ISE cmd short cut is saved C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Xilinx Design Tools 1\ISE Design Suite 14.7\Accessories. I run the file and Kaboom, the ISE cmd fired up. I entered mem_edit.bat and the application is up and running.

File.execute() is not executing my script. How to debug this issue?

I'm writing a script for Illustrator CS6 in ExtendScript. At the end of my script, I want to spawn a task (a second script, in Ruby) using File.execute(). However, it's not working. And I'm at a loss as how to debug the problem -- how can I figure out why this isn't working?
Here's the end of my ExtendScript file:
// Do a bunch of other work, then:
var rubyFile = new File(scriptFolder + 'BuildHtmlWalkthrough.rb');
alert(rubyFile.exists);
var result = rubyFile.execute();
alert(result);
Both rubyFile.exists and result are always true, indicating that the script launched OK. But the script does not appear to run, at all. I've tried the following diagnostics:
The Ruby script does successfully run from the command line. The script's permissions are -rwxr-xr-x
I added a call to system("touch /blah/blah/blah") as the very first line of the Ruby script. The file does not get touched.
I thought maybe the ExtendScript process was terminating before the Ruby script could run, so I added a long for loop after rubyFile.execute(). Spinning for > 30 seconds did not help.
What can I do to debug, or solve, this problem?
I'm on MacOS X v10.9.1. And for reference, this is the documentation for File.execute():
File.execute (): Boolean
Core JavaScript Classes
Executes or opens
this file using the appropriate application, as if it had been
double-clicked in a file browser. You can use this method to run
scripts, launch applications, and so on. Returns true immediately if
the application launch was successful.
It's probably doing the "opens this file using the appropriate application" instead of executing, and returns true because the file successfully opens (or is already open in its associated app). If I have a python script and do
f= new File("~/Documents/misc_scripts/getpixelrgb.py");
f.execute();
, it opens it in my script editor, even if the file's execute flags are set.
I'm on OSX, btw
In After Effects, there is system.callSystem() to execute command line commands, but I'm afraid that is absent in Illustrator (I'm assuming you're doing this for Illustrator because of the tag). Are you on OSX or Windows? There are ways around this, by making an executable .app (OSX) or .exe (Win) and calling that with execute(). If I were doing this, I'm on OSX and I'd make an AppleScript app that does 'do shell script' to make the ruby system call. On Windows, it's different. One solution you might like if you're on windows: ocra, which is ruby-specific (http://ocra.rubyforge.org/). It may be possible to run a .bat file on Windows that calls the ruby script, but I'm not sure.
[edit!]
Terribly sorry for the extraneous Windows info (for someone else, I guess). Just saw your note about being on OSX. So you might want to use the AppleScript solution.
[edit again]
So, if my ruby script ("test.rb") is:
#!/usr/bin/env ruby
print "Hello"
and my AppleScript is:
do shell script "cd /testing_folder/; ruby test.rb"
Then I get "Hello" returned in AppleScript, but ExtendScript will just return true.

VB.NET Process.Start failing

A problem that has been plaguing me for nearly a week now.
I am trying to get an install of IIS to take place through the command line in VB. I understand that i need to be setting up an Unattended xml script to call, but here is a fundamental bit that is confusing me:
If i run the command : ' start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer; ' it executes perfectly within CMD.exe.
If i add the command to a batch file and run the batch file, it runs perfectly.
If i call the command using : Dim myProcess As Process = Process.Start("cmd.exe", "/k start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;"), then it fails with an error of:
////////////////////////////////////////////////////////////////////////////////////////////////////////////
Operation failed with 0x8007000B ////
////
An attempt was made to run the program in an incorrect format ////
////////////////////////////////////////////////////////////////////////////////////////////////////////
If i call the batch file mentioned earlier, then i get the exact same error.
How can it work perfectly with the two first examples but fail when it is called through VB?
Thanks for any help!
Your VB.NET program is very likely to be running in 32-bit mode and will start the 32-bit version of cmd.exe. The one from c:\windows\syswow64 instead of the one from c:\windows\system32 that you used before. Getting BadImageFormatException starts to become likely.
Project + Properties, Compile tab, set the Target CPU to AnyCPU and untick the "Prefer 32-bit" option. On older versions of VS click the Advanced Compile Options button to get to the setting.

Can't write in tcl command line unless sending echo, after using PLINK

I'm having a confusing problem running a variety of programs from a tcl script. Here's the story: I have a script (in tcl) which executes plink to establish a remote connection on a Linux computer. I basically use eval for calling plink, sending as parameters some ssh commands and info, and also a bash file to be executed on the Linux computer.
So far, that works fine, or at least it does what I intend it to do. The issue here is that after calling this procedure, my prompt stops working the normal way. I can type, but it doesn't appear on screen unless the command I send is "echo" (without ""). If so, I get the "ECHO is on" message and the prompt continues to work normally.
Does anyone have any idea why this could be happening? I thought about just patch it and add the "echo" command inside my script, but it says that it's an invalid command in this case...
Well, thanks for the help!