Wait until execution ends

Hello,
I am using TestStand API in CVI to run a test sequence. I want the button start to be dimmed during the execution, so I wrote these lines: 
SetCtrlAttribute(panel, PANEL_COMMANDBUTTON, ATTR_DIMMED, TRUE);
TS_NewEngine (NULL, &lEngine));
TS_EngineGetProperty (lEngine, &errorInfo, TS_EngineGlobals, CAVT_OBJHANDLE, &stationGlobalsHandle));
TS_EngineGetSeqFileEx (lEngine, &errorInfo, "SequenceFile1.seq",TS_GetSeqFile_OperatorInterfaceFlags, TS_ConflictHandler_UseGlobalType,&lCurrentSequenceFile ));
TS_SeqFileGetFileGlobalsDefaultValues (lCurrentSequenceFile,&errorInfo, &fileGlobalsHandle);
TSerrChk( TS_EngineNewExecution (lEngine, &errorInfo, lCurrentSequenceFile,"MainSequence", modelSeqFile, VFALSE,TS_ExecTypeMask_Normal, CA_DEFAULT_VAL, CA_DEFAULT_VAL, CA_DEFAULT_VAL, &lCurrentExecution));
TS_ExecutionWaitForEndEx(lCurrentExecution,&errorInfo, INFINITE,TRUE,CA_DEFAULT_VAL,CA_DEFAULT_VAL,&end);
SetCtrlAttribute(panel, PANEL_COMMANDBUTTON, ATTR_DIMMED, FALSE);
But it's not working, the sequence is not even executed and the button remains dimmed.
If anyone can help me I would appreciate it. 
Thank you

There are several flaws in your approach:
You are not using Manager Controls
You are using WaitForEndEx which is documented as This method is not meant to be used by a user interface or sequence editor, as it does not process UIMessages. Instead, use this method from a step to synchronize with another execution. Remove this from your UI code!
The default visible TestStand button provides properties. Use them to do what you want.
thanks,
Norbert

Similar Messages

  • How do I create a table of 3 data elements for each trial and have it updated instead of waiting until the end of the program?

    I am trying to record 3 pieces of data, all (software) timing in ms (in U8 integers). I managed to finally get each data in the right column but now it doesn't record anything in the table and it doesn't update the numeric indicators during the experiment like it should. I can't figure for the life of me what I did wrong. I know at least the trial part of the program works, but so far the data recording part is giving me a headache.
    Thanks
    Attachments:
    BETACRT.vi ‏241 KB

    Why it is not reporting the data is easy; fixing the program may not be. LabVIEW uses a dataflow paradigm. This means that no part of the program executes until all of its data inputs are availble. In your case the table and the array functions driving it are fed by outputs from the outer while loop. Thus no data gets to the table until the while loop has finished executing (which is at the end of your experiment). One possible approach would be to store the data in a shift register and move the table inside the loop.
    Many experienced LV programmers try to avoid or minimize the use of sequence structures and local variables to read and write to/from front panel objects. We use a state machine which is a while loop with a case structure. Queues can be u
    sed to pass data between the user interface and the data acquistion loops. This subject is too involved to be handled in a brief posting, but if you search the archives and examples you can learn more.
    Also, be aware that software timing can be problematic if you are using a desktop operating system. If the OS decides to check the net for software updates or something you could have large discrepancies in your timing. These might be rare, but there is no reliable way of detecting them. I have built several systems similar to what you seem to be trying to do and have never been successful with software timing.

  • Wait for the execution end of a Thread

    Hi every body,
    How to make a program waiting the execution end of a thread,
    the instruction join did not work fine.
    Computation c = new Computation();
    Thread t = new Thread(c);
    t.start();
    t.join(); // here my thread dead
    System.out.println("done");
    Regards

    Did you try it without t.join?And t did its work fine in that case, but putting the join into the main thread caused t to not do anything?
    I can't say what's happening without more code, but two possibilities pop to mind:
    1) You changed something else, and join has nothing to do with it.
    2) You're syncing on t in a way that interferes with (or gets interference from) join (which also syncs on t).

  • Waiting for the end of the process

    I'm executing a command using the Runtime class and I have to wait until the end of the command to get the results. But, I don't want to sleep the thread for some undeterminated time. I'd like it just to wait until the command ends.
    See in this code:
    try
    String result="";
    Process p = Runtime.getRuntime().exec("sh"); //open a new shell
    InputStream is = p.getInputStream();
    OutputStream os = p.getOutputStream();
    os.write("ifconfig -a | grep PROMISC -c\n".getBytes());
    os.flush();
    try {
    Thread.currentThread().sleep(1000);
    /*command should take some time to execute so wait for 10 secs .... I don't like this .... I would prefer waiting for the end the command ifconfig*/
    catch (InterruptedException eIE) { }
    while (is.available() > 0)
    result = result + ( (char) is.read());
    System.out.println(result);
    catch (IOException e) {
    System.out.println(e);

    AFAIK you can only detect if the shell process has finished, as sub-processes of the shell are not visible to your Java program (without resorting to OS-specific syscalls).
    You can write "exit" (or whatever terminates your shell) in the output stream as the last command - this will quit the shell as soon as all commands are finished, and that will be visible to your prog. Note that you should not run ANY of the shell commands in background then, as this could cause the shell to exit before the commands are finished (and, depending on the system, even signal the subprocesses).

  • When receiving an call waiting can't push the hold and answer button.Because: it will put on hold the first caller, answer to the second, but you can't hear the second until you end the first call !!! Anyone has the same problem ? Did anyone know why ?

    When receiving an call waiting can't push the hold and answer button.Because: it will put on hold the first caller, answer to the second, but you can't hear the second until you end the first call !!! Anyone has the same problem ? Did anyone know why ?

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Wait until command execution effects actually take place

    Hello everybody. I am new to Azure and I have been working with power shell for a short time.
    During my work, I have noticed that many operations like Update-AzureVM or Stop-AzureVM return before the requested changes have finished being applied. Furthermore, there are other more complicated issues, such that it takes some time for locks on blobs
    of data disks times to become unlocked. All these kinds of I-have-not-actually-finished-doing-the-work situations often break my scripts unless I manually implement sleep-and-check code blocks.
    My question is, is there any more or less general way to wait until resources (VMs, disks, etc.) are ready to continue? Maybe a supporting library to perform this waits?
    Thank you in advance

    The Azure forums are over here.
    https://social.msdn.microsoft.com/forums/azure/en-US/home?category=windowsazureplatform%2Cazuremarketplace%2Cwindowsazureplatformctp
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • I can't wait until my contract ends!

    Couldn't believe it...Phone customer care to ask if and increase from 10Mb download to 40Mb download would increase my contract length.........?
    Yes it would.................Not this callsign I can't wait until I get Sky!
    Remember that if you live on the outskirts of an area you are charged the same but don't get the same speeds!

    OtisRoundtree wrote:
    Been a customer for over 10yrs, but this is the last year! Customer service *****, the phones suck and the prices suck. Dueces!!!
    And the grass is not always greener on the other side of the fence... Since you are going to drop Verizon, are you sure your coverage from other carriers is sufficient for you? Just make sure it works for you, and if you can switch, get good coverage, and save money, kudos to you.

  • I accidentally turned off wifi and ran some videos overnight on my mobile and used all of my data allowance on day 3 of the month. I screwed up... I acknowledge that... do I bump my plan up 1gb at a time or wait to the end of the month to adjust the bill.

    I just need to know my best options to control the amount I pay in overages since I messed up. Been with Verizon for at least 15 years and I haven't really had this come up before. Not sure how I messed up this bad this time

    Personally, I would wait until ~5-7 days before the end of your billing cycle to make the adjustment RETROACTIVE to the beginning of your current billing cycle. That way you can add what you need with a bit extra for the last 5 days. Of course you would want to make another adjustment on the last day of your billing cycle to drop your data allowance back to normal, only have that adjustment made effective on the 1st day of your NEXT billing cycle. You don't want to have to pay for the extra data NEXT month.

  • File Adapter -- Picking has to wait untill it get fully loaded/write.

    Hi All,
    I need to pick the files from a folder and I need to pick the files only which has been written completely.
    I should not pick the file in the middle while writing, I need to wait untill it finishes the writing completely.
    Is there any setting I can put in Sender File adapter to do this?
    Thanks
    Seema

    Nithya,
    >> Try to increase the processing time in the sender communication channel, so that it allows you to completely load the file. Check the time which is needed to upload the file to the directory manually and correspondingly change the processing time.
    We do not know exactly at what time the file will be placed in the folder. It may be at any time. So I cannot put the processing time accurately.
    Aamir,
    >> If you are picking from FTP,MSecs wont work there.the sender program which writes the file must write the file in some temporary format like .dat etc and once the file is complete it should change the filename to .txt,configure the sender file adapter to pick only *.txt files.
    This is a good idea. But I don't think I can ask them to change at the other end as it is working previously with other middleware.
    Guys,
    Can you please advice which is the best thing we can do at this point of time.?
    Thanks
    Seema.

  • How can I wait until a Swing.Timer has finished?

    I have a Swing.Timer runing which displays some animated text (more precisely it fades out a text with a delay of 50 until all characters are erased.
    Afterwards a time consuming operation shall begin. How can I achieve that this operation waits to start until the text has been faded out? The time to fade out the text depends on the length of the text, of course.
    So, how can I make the operation waiting until the Timer has finished its work?
    Thanks,
    Dirk

    dirku wrote:
    I have a Swing.Timer runing which displays some animated text (more precisely it fades out a text with a delay of 50 until all characters are erased.
    Afterwards a time consuming operation shall begin. How can I achieve that this operation waits to start until the text has been faded out? The time to fade out the text depends on the length of the text, of course.
    So, how can I make the operation waiting until the Timer has finished its work?I gave you an answer to this with sample code yesterday:
    [http://forum.java.sun.com/thread.jspa?threadID=5294087&messageID=10244564#10244564|http://forum.java.sun.com/thread.jspa?threadID=5294087&messageID=10244564#10244564]
            public void actionPerformed(ActionEvent e)
                if (sb.length() > 0)
                    sb.deleteCharAt(0);
                    label.setText(sb.toString());
                else
                    label.setForeground(color);
                    label.setText(text);
                    Timer timer = (Timer)e.getSource();
                    timer.stop();
                    // ***** start process here ***
            }The timer here continues until a condition is satisfied (here it's where the Stringbuffer that holds the text that is sent to the JLabel is empty). So all you have to do is place any code that needs to happen when the Timer ends in the else block. It's so simple as to be trivial.

  • Return Code value using 'starting new task' and 'wait until'

    I'm having a minor issue with some return code values in my ABAP.
    This is what part of it used to look like before I modified it:
    With Code in version 1, the sy-subrc was not always zero, sometimes it would be 4.
    That was fine, and my abap would do something based on the non-zero RC.
    had a need to implement an RFC timeout, the only way I could see to do it was to use 'starting new task' etc as seen in Version 2.
    However, with my changes, sy-subrc is always zero.
    The ABAP runs fine but I know that sy-subrc should sometimes be 4, even when it returns within the allotted 60 seconds.
    Maybe I've coded it incorrectly.
    Can someone point me in the right direction?
    #>> Start of VERSION 1
      call function 'MY_FUNCTION_MODULE'
           destination RFCDEST
           tables
                orders_list          = t_orders_packet
                apo_orders_list      = t_apo_orders
                apo_resources        = t_apo_resources
           exceptions
                COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
                SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
                NO_ORDERS_SUPPLIED       = 3
                NO_PEGGED_ORDERS_FOUND   = 4
                ORDERID_CONVERSION_ERROR = 5
                OTHERS                   = 6.
    if sy-subrc is initial.
      * do some stuff as RC was 0
    else.
    * log non-zero return code etc
    endif.
    * << End of Version 1

    And now Version 2.
    I didn't put this into the 1st post as the formatting goes bonkers.
    #>> Start of VERSION 2
      call function 'MY_FUNCTION_MODULE'
           destination RFCDEST
           starting new task 'taskname'
           performing receive_result on end of task
           tables
                orders_list          = t_orders_packet
                apo_orders_list      = t_apo_orders
                apo_resources        = t_apo_resources
           exceptions
                COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
                SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
                NO_ORDERS_SUPPLIED       = 3
                NO_PEGGED_ORDERS_FOUND   = 4
                ORDERID_CONVERSION_ERROR = 5
                OTHERS                   = 6.
      WAIT UNTIL results_received = 'X' UP TO 60 SECONDS.
    if sy-subrc is initial.   << Now this is always ZERO
      * do some stuff as RC was 0
    else.
    * log non-zero return code etc
    endif.
    FORM receive_result USING iv_taskname.
      RECEIVE RESULTS FROM FUNCTION 'MY_FUNCTION_MODULE'
           tables
                orders_list          = t_orders_packet
                apo_orders_list      = t_apo_orders
                apo_resources        = t_apo_resources
           exceptions
                COMMUNICATION_FAILURE    = 1 MESSAGE MSG_TEXT
                SYSTEM_FAILURE           = 2 MESSAGE MSG_TEXT
                NO_ORDERS_SUPPLIED       = 3
                NO_PEGGED_ORDERS_FOUND   = 4
                ORDERID_CONVERSION_ERROR = 5
                OTHERS                   = 6.
      results_received = 'X'.
    endform.                    "receive_result
    * < End of Version 2

  • System Exec use all resources system if "wait until completion" is true !

    Hello,
    I use the function "System Exe" since a long time to launch various executables since Labview.
    The " waint until completion " boolean is true, because I have to wait the end of the external executable to continue.
    Big problem: the function " System Exec " use all resources system, by waiting for the end of the external program.
    Is it a bug of this function ?
    In my example, "System Exec" launches only the notepad (LV 8.2 on XP)
    Thank you for your suggestions.
    AC
    AC
    Attachments:
    Process.jpg ‏86 KB
    Bug system exec.vi ‏17 KB

    Thanks to both for your speed.
    In fact I had simplified my vi to target the problem.
    I use System Exec to launch another executable, made possibly with labview, but with passage of parameter. (Ex: - " / string:init ").
    In the literature Labview it was made with the method cmd / x / c start by putting twice the path of the executable.
    In this method a waiting time in the recent system exec function was effectively missing.
    But effectively, today, it is enough: "c:\myexe.exe" - " / string.init " to launch and to pass a parameter.
    You have both reason and I thank you sincérement.
    Very cordially.
    Sorry for my English....
    AC
    AC

  • Java.lang.Process input stream waiting until process is complete to print

    I have tried to simplify this problem as much as possible. Basically, I have a java.lang.Process which executes a simple C program.
    test.c
    #include <stdio.h>
    #include <unistd.h>
    int main()
      printf("foo\n");
      sleep(2);
      printf("bar\n");
    ...The process has an input stream and error stream handler each on a separate thread. I have tried both buffered and unbuffered (BufferedReader, BufferedInputStream, InputStreamReader...) stream handlers. Both produce the same problem of waiting until the process has exited to receive anything from the process's streams.
    The only time this does not happen is when I call fflush(stdout); after each printf(). This can't be a solution because the real application calls a massive C application which would require thousands of fflush()'s to be added. What is causing this to happen? This doesn't happen when the C program is executed from the shell. Is there a way the InputStream can be forced to extract from the stream?

    hi.....
    I have closed the output stream of the process as you told me to do...
    The hitch is that, if my program contains only printf() statements,it works fine
    as soon as scanf() statement is encountered within the C code,it is totally neglected,and the output comes as if no scanf() statement existed in the C code.
    Consequently the thread doesnt wait for input which was bound for scanf() from the thread
    the code...
        public void run()
         try
             PrintWriter out = new PrintWriter(socket.getOutputStream(),true);
             BufferedReader in = new BufferedReader(
                            new InputStreamReader(
                            socket.getInputStream()));
             try
                     Process p;
              p=new ProcessBuilder("./a.out").start();
                     PrintWriter exOut=null;
                     BufferedReader exIn=null;
              exOut = new PrintWriter(p.getOutputStream(),true);
              exIn = new BufferedReader(
                           new InputStreamReader(
                           p.getInputStream()));
                  //String inputLine="", outputLine="";        
                  String str="";
                     int c;          
                  while(true)                   
                        //System.out.println("In While");
                  str="";exOut.close();                  
                        while((c=exIn.read())!=-1)
                                 str=str+(char)(c);
                                    System.out.print(str);
                        str=str+(char)(0);
                        System.out.print(str+"outside");
                        out.print(str);
                        sleep(100);
                        try
                            int x=p.exitValue();
                              out.print(str);
                   System.out.print("Bye 1");
                            String str1="Bye"+(char)(0);
                   out.println(str1);              
                   break;
                        catch(IllegalThreadStateException e)
                            //System.out.println("The Process has not ended yet");
                        //str=str+((char)-1);
                        //System.out.print(str+"Control reaches here too");
                        str="";
                        exOut = new PrintWriter(p.getOutputStream(),true);//I have tried to run the program without this also but the effect is the same
                        while((c=in.read())!=-1)
                            str=str+(char)(c);                                    
                        if(str.contentEquals(""))
                                System.out.print("Bye 2");
                                String str1="Bye"+(char)(0);
                                out.println(str1); 
                                p.destroy();
                                exOut.close();
                                exIn.close();
                                out.close();
                                in.close();        
                                socket.close();
                                break;
                        //str=str+(char)(0);
                  exOut.print(str);
                        try
                            int x=p.exitValue();
                            System.out.print("Bye 3");
                            String str1="Bye"+(char)(0);
                   out.println(str1);
                            break;
                        catch(IllegalThreadStateException e)
                            //System.out.println("The Process has not ended yet");
                  /*while ((inputLine = in.readLine()) != null)
                        exOut.println(inputLine);
                        outputLine=exIn.readLine();
                        //outputLine=inputLine;
                        //out.println(outputLine);}*/                   
             exOut.close();
             exIn.close();
             catch(IOException e)
                  System.err.println("Accept failed."+e);
             out.close();
             in.close();        
             socket.close();
         catch (Exception e)
             e.printStackTrace();
    }

  • How to wait until an Entourage Schedule item completed

    I am trying to script the "Send & Receive All" operation in Entourage, and I have found that I can trigger the process off (from within my script) by:
    tell application "Microsoft Entourage"
    execute schedule "Send & Receive All"
    end tell
    However, the script continues to process while the scheduled actions take place.
    Is there any way to wait until the schedule actions complete and then process the rest of the script?
    Thanks
    Susan

    Glad to help, Susan
    I found out about "connection in progress" by looking at the properties of "application" in the Entourage dictionary:
    connection in progress boolean [r/o] -- Are there any network connections in progress?
    (In fact I searched through the dictionary for the phrase "connect".) The property is a boolean (true/false), and my script uses a "repeat while" loop to test for that boolean condition.
    As well as properties, the Entourage application object also has elements. These include "POP account", "IMAP account", "Exchange account" and "Hotmail account". These can be referred to "by numeric index, test". So if you pass a list of accounts to the "connect" command, Entourage will connect and download mail from those accounts. For example, if you have two POP accounts, this works:
    tell application "Microsoft Entourage" to connect to {POP account 1, POP account 2}
    AppleScript lists are contained in curly braces.
    But it's simpler (and less prone to error) to do this:
    tell application "Microsoft Entourage" to connect to every POP account
    Alternatively, the "test" lets you refer to individual accounts by name - a list isn't essential, despite what the dictionary says:
    tell application "Microsoft Entourage" to connect to POP account "My Account"
    There's many ways of skinning a cat.
    To answer your more general question, though, there is no one "user guide" for AppleScript. You can learn the about the basics of the language from the AppleScript Language Guide. But that will tell you nothing about how to script particular applications. This is because every developer, if they do implement AppleScript in their application (and lots don't), implements it in different ways.
    So as well as learning AS, for each application that you want to script you have to learn a slightly different set of commands. There's an awful lot of trial and error involved, but one way to learn is to look at scripts that others have written. There are good resources at Apple's own AppleScript page and at AppleScript Central among others. For specifically scripting Entourage, try Paul Berkowitz's scripts.
    Different people will also recommend different books. My recommendation is AppleScript: The Definitive Guide by Matt Neuberg, but again it's not application-specific.
    Hope this helps, at least to give you some pointers.
    H

  • Wait for execution to complete

    Hello,
    I have a simple question about the "wait for execution to complete" option by using new execution:
    does the caller wait for the end AFTER executing the Cleanup, or just after the Main sequence?
    regards
    Solved!
    Go to Solution.

    At the end of Cleanup at the <End Group> tag.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

Maybe you are looking for

  • It appears to be a javascript problem, but firefox cannot open pages from ebscohost websites.

    I'm a librarian at DePauw University. People who have upgraded to Firefox 5.0 or higher can get to Ebscohost pages but once there cannot do anything. For example, if I am on the Ebscohost Scientific American page and I try to expand +2011 in order to

  • How do I run iTunes completely from my external hard drive?

    Here's my dilemma: My laptop's internal C: hard drive is busting with data - it's full.  So in an effort to simplify and create space, I bought a 1TB external hard drive (F: drive) and moved all of my media, including iTunes, over to it for simplicit

  • Performance issue of simple mapping

    Hi All, We cretated one simple mapping the details are as follows: 01. We had created on public dblink in Oracle 11g pointing to sqlserver 02. By using the publicdblink we create one view at Oracle 11g. This view acts as a source in my mapping. 03. W

  • "Movie not loaded..." swf error on html

    Hi everybody! I have a problem when i export a swf and html in flash, because when i upload it to my server and try it online i get the message "Movie not loaded..." when i click in a blank window where it should have played. In the activity window i

  • What would cause a prolonged blue screen during start up?

    I have an iMac desktop.  Recently I've had trouble with a prolonged blue screen during start up (approx. 10 mins) before it finally takes me to the login screen.  Any ideas why this is happening? Jeff P.