Stop an external program
Is there a chance to stop an external program (ftp server what causes problems when then currently programs wanted to be copied) on a Windows PC from LV 6.1?
Best regards
Jo Hesse
There is a library of VIs on the web that allows LabVIEW to make several cool Windows API calls. One of the VIs will quit applications. On the home page, www.ni.com, enter windows api function 32 in the search window. It should be the second hit. The full title follow: Windows API Function Utilities (32-bit) for LabVIEW
Jeremy Braden
National Instruments
Similar Messages
-
Launching External programs from an addon cause Client to stop
Hi.
We have an add-on that allow via configuration to launch other programs/files from SAP (Remote desktop, PDF-documents, etc.).
Launching other processes from an add-on is easy with the System.Diagnostics.Process.Start(file, arguments);
This has worked since SBO2004A, but since we began working with SBO2005A SP01 launching external programs cause the SAP Client to freeze every 5-10th time or so...
Nothing except stopping the add-on-process works.
When the add-on is terminated the Client "Wakes up" to inform that add-on has been disconnected.
Anyone else have had a similar problem?
<i>Kind Regards
Rasmus Wulff Jensen | http://www.b1up.net</i>Regarding the thread, I whought about it, but since it is a process.Start, it a whole different process and threads should not have anything to do with it...
As always, yes I've created a message for this.... And got the normal response from SAP Support "We cant reproduce the issue... please send sample code"... sigh.... Hate random error that can't be reproduced... and sample code is hard to produce when you have created a whole framework above the SDK... I almost never do any "Core" SDK... -
Before calling an external program, check if the program is allready open
I need to call an external program to print some labels, so i will use function WS_EXECUTE or the new one DSVAS_DOC_WS_EXECUTE_50 to call my program, but the problem that i have is:
when I call this function, the program open a small window, and if i have to call it again, it will open another window, and so on... obviously this is not a good solution.
Is there any one how knows how can i close the program, of perhaps it is enough if there is some way to know if the program is already open.
Many thanks in advance,
MiriamHi
you can use the ABAP Coverage Analyzer.
OR
This is a function module we use to limit the execution of a program to one instance at a time.
DATA: PRG LIKE INDX-SRTFD. PRG = SY-CPROG.
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING RELID = 'ZZ'
SRTFD = PRG
SRTF2 = 0
EXCEPTIONS FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2.
IF SY-SUBRC NE 0.
FORMAT COLOR COL_NEGATIVE INVERSE ON.
WRITE: / 'ERROR: Program Is Already Running'.
WRITE: / 'Program', PRG, 'has been stopped. Rerun in 1 minute.'.
STOP.
ELSE.
WRITE: / 'OK ',PRG.
ENDIF.
Regards,
Raj -
Dear All,
We are facing error in one of external programe; which is included in one of step of a job. the programe is 'sleep' which is resposible for inserting delay in job e.g. 300 sec. the value 300 is the parameter for the external programe.
when we run the job this program doesnt stop. keep on giving delay in job. or else in other job it doesnt run .... can any budy suggest hte troubleshooting of the same.
Thanks in advanse.
<b>Regards,</b>
Swapnil LakheHello Swapnil,
The most probable reason that I get from the description is that the counter is never passed back to the job control.
What you can do as an alternative is write an simple ABAP to loop for 300 secs and then write an message Like "Completed or finished" and enter this ABAP program as an step instead of the External program.
This should work 100 %.
Regards
Amit -
AIR 2.6: Run external programs sequential (1 by 1)?
Hi,
I managed to run an external program in Adobe AIR (2.6). I'm using the NativeProcess for this. I would like to perform the following actions.
Pseudo-code:
execute program.exe
this will return a port number
set the port number as an environment variable (in windows)
execute program.exe with several queries
stop progam.exe
The corresponding executables:
C:\my_proj\program.exe start
var portnumber:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
C:\WINDOWS\system32\cmd /c set port=portnumber
C:\my_proj\program.exe query test1
C:\my_proj\program.exe query test2
C:\my_proj\program.exe stop
My problem is the bold text in my source code underneath. I'm trying to wait till the first native process is finished and had returned its output. Once I have this output (=the portnumber) I can continue with the following action. And this is needed for all steps ... to execute them one by one.
But "do {} while (process.running);" is not working. My AIR applications is getting stuck in this loop ... as if process.running is always true.
Any idea how I can execute external programs sequential?
This is my source code:
var file:File = File.applicationDirectory;
file = file.resolvePath("NativeApps");
if (Capabilities.os.toLowerCase().indexOf("win") > -1)
file = file.resolvePath("C:\\my_proj\\program.exe");
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
var processArgs:Vector.<String> = new Vector.<String>();
processArgs[0] = "start";
nativeProcessStartupInfo.arguments = processArgs;
nativeProcessStartupInfo.workingDirectory = File.documentsDirectory;
var process:NativeProcess = new NativeProcess();
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
process.start(nativeProcessStartupInfo);
do {} while (process.running);
file = file.resolvePath("NativeApps");
file = file.resolvePath("C:\\WINDOWS\system32\\cmd");
var nativeProcessStartupInfo2:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo2.executable = file;
processArgs[0] = "/c";
processArgs[1] = "set";
processArgs[2] = "port="+portnumber;
public function onOutputData(event:ProgressEvent):void
var process:NativeProcess = event.target as NativeProcess;
var portnumber:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
public function onExit(event:NativeProcessExitEvent):void
process.exit();Hello,
The "do {} while (process.running);" may take almost all of the resource, so other code was blocked, then the program seems no response.
You can add the following code in the onOutputData, like:
public function onOutputData(event:ProgressEvent):void
var process:NativeProcess = event.target as NativeProcess;
var portnumber:String = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvail able);
file = file.resolvePath("NativeApps");
file = file.resolvePath("C:\\WINDOWS\system32\\cmd");
var nativeProcessStartupInfo2:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo2.executable = file;
processArgs[0] = "/c";
processArgs[1] = "set";
processArgs[2] = "port="+portnumber; -
Hi All
I really hope that some one can help ,e with my problem as i have no idea. OK i am calling an external program that outputs documents. This program uses control files and for each job there are 5 control files. Thus i call this program 5 times to get all my output documents. When i run this program from the command line then it works fine, however when i call it from my code i can see that it is working because my outputs are processed and i can see the program in the task manager. But it stops and does not continue to the next call, its like after this program does the processing then it just hangs. I dont know what is wrong and i cant get any errors in the logs either. I think that the problem either is with my java instalation as i had problems on the server and had to re-install java because someone installed multiple versions or that it is a jvm problem. Can some one please give some ideas of what could be the problem. My code looks as follow:
Process p = Runtime.getRuntime().exec("d://cep//nt_engine_010_62 prodengine -controlfile=d://cep//document1.txt");
p.waitFor();
System.out.println(p.exitValue());You may want to give this code a try:
ProcessBuilder pb = new ProcessBuilder( whatever_command );
pb.redirectErrorStream();
Process p = pb.start();
InputStream is = p.getInputStream();
BufferedReader br= new BufferedReader( new InputStreamReader( is ) );
for ( String line = br.readLine(); line != null; line = br.readLine() )
System.out.println( line );
p.waitFor(); -
How can I execute an external program from within a button's event handler?
I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
So, then, how can I do this?
Thanks
Ted
NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
try {
java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
//pn.directory(new java.io.File("K:\\work"));
java.lang.Process pr = pn.start();
java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
String tmp = new String("");
byte b[] = new byte[1000];
int i = 0;
while (i != -1) {
bis.read(b);
tmp += new String(b);
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
} catch (java.io.IOException ex) {
getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
}Hi Fonsi!
One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
/Thomas -
How can I eject my ipod when neither itunes not the "safe to eject" button will allow it. Itunes says "...cannot be ejected because it contains files that are in use by another application." The safe to eject button says "The device 'generic volume' cannot be stopped because a program is still accessing it." The has never happened before. The only thing new is that I added an iPad yesterday. Thanks.
Go to your computer's System Tray and try ejecting. If you can't eject, there is an application that is trying to access your iPod.
Go to http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx and download ProcessExplorer.
Go to http://support.microsoft.com/kb/555665 and follow the instructions under Resolution.
Note that this is a good, general process any time you can't access any file.
In my case an update to RealPlayer installed a program called RecordingManager that was accessing my iPod. -
System exec, How I say to open one file and make operation in external program?
Hi,
I got called an external program with the system exec.vi, but i would like the program open the file saved in the other window, i can get the file path, but how Can I put the file path in the external program and the program open the file and I tell (in this case compile), since i open one file code c and only i must to open and say to the program 'compile' and then close external program.
Any help?. Thanks.
Attachments:
system_exec.GIF 8 KBHi Fonsi,
System Exec.vi will allow you to run commands like launching a program easily but it is difficult and many times not possible to execute commands within an application.
A better way maybe to approach this though ActiveX. Please look at the following example that uses ActiveX to communicate with Excel.
Writing Rows to Excel 97 and Excel 2000 Using ActiveX
If you are not familiar to ActiveX and LabVIEW, please read the document below:
ActiveX and LabVIEW
I hope this
helps.
Sincerely,
Feroz
National Instruments -
How can I display files in external program like Word?
Using NetBeans 6.5, IE7, Windows XP
I have not had any luck attempting to get a PDF file to display in a separate browser window,
so I thought I might try to combine that with a new issue.
I have 3 file types - jpg, rtf and pdf that should be able to be displayed in external programs like Word or Adobe.
Is there a way to start an external application and pass the file name from a backing bean?
The files would be located on the server in a directory that is mapped to the client and the applications (Word, etc.) would reside on the client.
Can this be done from within the confines of a JSF application?
ThanksI was kind of hoping that someone could point me to an example of how to do this.
I've tried the servlet approach, but can't seem to get the file to display in a separate browser window.
That is why I thought about maybe launching a separate application, if that is possible. -
I have been reading about the Firesheep add-on that allows the user to hijack sessions of users on the network by stealing the cookie. I understand that to prevent any application from stealing the cookie, the cookie should not be passed by the site without SSL. However, my understanding of how Firesheep works is that it interfaces with Winpcap (a network sniffer). So my question is "How can an add-on execute an external program or operating system command like Winpcap?" Can any add-on do this and should I be extremely afraid of downloading any add-on because of the potential that it could have complete access to my system?
Hi Scott-L.
You asked a very good question and it turns out you're right.
However, one must be aware that download an Addon on another website that Mozilla may be dangerous. Indeed, the Addons found on the Addon Center are checked (roughly).
In addition, Firefox includes a blacklist that blocks addons identified as malicious.
More information here: [http://www.computerworld.com/s/article/9193420/Mozilla_No_kill_switch_for_Firesheep_add_on?taxonomyId=17&pageNumber=1] -
How do I call an external program
From within my Java program I want to execute an
external program and dump the output into a string
or array of strings. In perl this is trivial $a=`dir`.
How do I do it in Java?
Thanx,
Art.with Runtime
try {
Process p = Runtime.getRuntime().exec("cmd.exe /c dir");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String str = "";
while((str = in.readLine()) != null)
//do what you want to with input
in.close();
catch(Exception e)
e.printStackTrace();
[/code[ -
I'm running Labiew 6i for Linux. I'm using a system exec.vi to call an external program to do image manipulation (since there is no IMAQ for linux). How can I embed the user interface of the external program into the front panel of Labview?
As far as I know, the only way to embed other GUIs in LabView is an ActiveX in a container.
As long as you are using Linux, try to place (moving them on the desktop ) the two windows linked (like those 3 of WinAmp). -
How can I run an external program without quitting Firefox?
I want to run an external program from within Firefox, much as Outlook express is run from the email button. How do I set this up?
Firefox doesn't import my Bookmarks from the listed html file. Any cure for this?I don't want to run the mail program, I want to run another program.
Maxthon allows me to do this using External Tools. Does Firefox allow me to run other programs without leaving Firefox?
2. Firefox allows me to load an html file which contains my bookmarks, but it doesn't load the bookmarks file. is there a solution? -
How can I run an external program from a PLSQL procedure?
Is there a package to run an external program from PLSQL? or is there another way to do that?
thanks.here there is an example about how a PL/SQL procedure can
work with an external C program.
http://download-east.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_pi2.htm#1003384
Apart from that you have Java Stored Procedures option
to carry out your task.
Java Stored Procedures Developer's Guide Contents / Search / Index / PDF
http://download-east.oracle.com/docs/cd/B10501_01/java.920/a96659.pdf
Joel P�rez
Maybe you are looking for
-
Want to partition a new External Hard drive for both pc and mac
Hello! I am going to partition a new Seagate external hard drive for both my pc and mac. What format do I choose for the PC partition? MS-DOS (FAT), ExFAT, or Free Space. Thank you! Nikki
-
Using Aperture with Adobe Bridge: Can It Work?
I have used all the Adobe apps for ages and love them. Photoshop and Bridge are a mainstay of our studio operation here. I have been using Adobe LightRoom lately to deal with my RAW shooting. I take it to a certain point with LR then I use Bridge to
-
Text in delete button in Edit bookmark popup wont show when avast online security plugin is enabled
I tried this disabling all extensions and enabling them one at a time. the avast is the culprit. Google didn't help me to find this issue. Maybe I would have posted it in avast forum? Thank for help (although this is not a critical issue as long as o
-
Resource start timeout always at 60 seconds
Hello all, I'm using clusterware for a standard database cluster. As my storage is NetApp I want to use snapdrive software to load dynamically LUN (3 per database). I've a script correctly working by hand. Time needed for LUNs to be attached is varia
-
Can Someone Explain the order of things Using Swingworker?
Hi: Can someone explain very clearly the order of things using Swingworker? Please do not refer the SUN tutorials. I am totally dead in the water with a very large application and the order of things is not sensible. Also, if the worker thread is too