How do I pass arguments to a TestStand sequence from an operator interface written in LabWindows​?

I intend to use TS_EngineNewExecution() which takes a VARIANT parameter for the arguments.
I have only found example code for C++ where a propertyObject containing the arguments is converted to a VARIANT using the constructor of the _variant_t class.
How do I accomplish this in LabWindows?

Hi webprofile,
I did not extensively test this code, but based on the previous posts, this is what the function might look like (I bolded the changes from what ships by default):
TERetval Eng_BeginSeqExecution(tSeqFileRec *seqFileRec, // must NOT be NULL
                               tSeqRec *seqRec,            // must NOT be NULL
                               ListType checkedStepList,
                               TEBool breakAtFirstTest)
    HRESULT res = 0;
    ERRORINFO errorInfo;
    TEBool errorOccurred = FALSE;
    CAObjHandle newExeH = 0;
    VARIANT editArgsVar;
    CAObjHandle editArgsH = 0;
    CAObjHandle params = 0;
    LPDISPATCH dispPtr; // varible used to convert parameters from CAObjHandle to Variant
    // Create container that will hold two parameters. First parameter is a number, second is a string.
    oleErrChkReportErrInfo(TS_EngineNewPropertyObject (sTEEngineObj, &errorInfo, TS_PropValType_Container, VFALSE, "", 0,&params));
    TS_PropertySetValNumber (params, &errorInfo, "Param1", 1, 45);
    TS_PropertySetValString (params, &errorInfo, "Param2", 1, "This is a string");
    // Converts CAObjHandle to Dispatch pointer
    TERetChk(CA_GetDispatchFromObjHandle (params, &dispPtr));
    TERetChk(CreateEditArgsObj(0, seqFileRec->seqFileH, seqRec->seqH, checkedStepList, &editArgsH));
    if (editArgsH) {
        LPDISPATCH editArgsDispatch = NULL;
        CA_GetDispatchFromObjHandle (editArgsH, &editArgsDispatch);
        editArgsVar = CA_VariantDispatch(editArgsDispatch);
    } else
        editArgsVar = CA_DEFAULT_VAL;
    oleErrChkReportErrInfo(TS_EngineNewExecution (sTEEngineObj, &errorInfo,
                                                  seqFileRec->seqFileH,
                                                  seqRec->seqName, 0,
                                                  TEBool2VBOOL(breakAtFirstTest),
                                                  TS_ExecTypeMask_Normal,
                                                  CA_VariantDispatch(dispPtr),
                                                  editArgsVar,
                                                  CA_DEFAULT_VAL, &newExeH));
    /* we'll get this again later on the StartOfExecution event
     * so free this reference to it */
    CA_DiscardObjHandle(newExeH);
Error:
    if (editArgsH)
        CA_DiscardObjHandle(editArgsH);
    return !(errorOccurred || res < 0); /* return TRUE if no errors occurred */

Similar Messages

  • How can I pass arguments to a TestStand sequence with LabWindows 6 ?

    Hi
    I have created sequences in a TestStand file.
    I want to program a sequence with Labwindows 6 which would call all these existing sequences (containing parameters).
    I don't have any problems to create the steps "SequenceCall" but i don't know how to pass arguments to the sequences with the TS API.
    I have used the look-up strings "TS.SData.SFPath", "TS.SData.SeqName", "TS.SData.ThreadOpt" to program the sequence file / sequence and the multithread option. But now how to program the arguments passing ? I think there is something with the lookup string "ST.SData.ActualArgs"...
    Thank u very much for any help

    I'm not sure if you want to pass values from TestStand to LabWindows or if you want to pass values in TestStand from a sequence call step to a called sequence.
    To get TestStand variables from LabWIndows, use the following function:
    tsErrChk (TS_PropertyGetValNumber(testData->seqContextCVI, &errorInfo, "Locals.StartPoint", 0, &dStartPt));
    iStartPt = (int)dStartPt;
    The TS_PropertyGetValNumber gets the TestStand variable Locals.StartPoint and puts it into the LabWindows variable called dStartPoint. Numbers to and from Test Stand are always a double type. The next line converts it to an integer.
    To put a LabWindows value to TestStand, use TS_PropertyPutValNumber.
    To pass values from a sequence call step to a called sequence, create variables in the Parameters t
    ab on your main sequence. Create same variables on the Parameters tab of the called sequence. In main, specify module to be called in calling step. There is a paramters section on the Edit Sequence Call dialog box which appears. Check the Use Prototype of the Selected Sequence box. You can then list all the parameter variables in the parameters section.
    Hope this is what you want.
    - tbob
    Inventor of the WORM Global

  • Passing arguments to the jsx file from command line

    Thanks for taking my question.
    I am using the following to be able to run my script from the command line.In case you were wondering on why i would be doing this- i would need to invoke the javascript from a server side code(like java,php etc. in my case it is java)
    "c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx"
    Anyways, i have been successful in running the myscript.jsx from the command line but i am not able to figure out how i could pass arguments to "myscript.jsx" from the command line, and be able to refer to these arguments within the script.
    I have tried the following
    "c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx" "argument1" "argument2"
    and tried to refer these arguments within the script using arguments[0] and arguments[1] . But looks like this does not work.
    Any thoughts?????

    To run JavaScript from the prompt using ExtendScript Toolkit 1.0.3 or 2.0.2 you need to do the following:
    Add the line #target indesign to the top of your script otherwise ESTK will open without executing the script. Example:
    #target indesign
    //MakeDocumentWithParameters.jsx
    //An InDesign CS2 JavaScript
    //Shows how to use the parameters of the document.open method.
    //The first parameter (showingWindow) controls the visibility of the
    //document. Hidden documents are not minimized, and will not appear until
    //you add a new window to the document. The second parameter (documentPreset)
    //specifies the document preset to use. The following line assumes that
    //you have a document preset named "Flyer" on your system.
    var myDocument = app.documents.add(true, app.documentPresets.item("Flyer"));
    //SaveDocumentAs.jsx
    //An InDesign CS2 JavaScript
    //If the active document has not been saved (ever), save it.
    if(app.activeDocument.saved == false){
    //If you do not provide a file name, InDesign will display the Save dialog box.
    app.activeDocument.save(new File("/c/temp/myTestDocument.indd"));
    Ensure Indesign is open. Execute the following command:
    "C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "[path to script]\script.jsx"
    For example:
    "C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "C:\Program Files\Adobe\Adobe InDesign CS2\Presets\Scripts\test.jsx"
    This command can be easily called from Java or any other third party application of your choice.
    It took me a while to find this information, so I thought I'd share it with everyone.
    Good luck!

  • Warning: passing argument 2 of 'setValue:forKey:' from distinct Objective-C

    I want to keep my projects warning free. In the following line
    [tempValues setValue:@"Some Text" forKey:[NSNumber numberWithInt:0]];
    the compiler complains with an
    "warning: passing argument 2 of 'setValue:forKey:' from distinct Objective-C type" warning.
    tempValues is an NSMutableDictionary.
    Any idea how to resolve this warning?

    Essentially, the typical rationale behind this particular warning is: The compiler must not let you write code that seeks to modify a non-modifiable object without giving some warning.
    Are you in effect trying to modify a non-modifiable object?
    Remember...(and I quote because I'm too lazy otherwise) "When you have a variable of type NSMutableArray*, then anyone would think that the array it points to can be modified. So if this variable contains a pointer to an actual non-mutable array, that would be a recipe for disaster, because any attempt to actually modify the array would fail in some way. For that reason, Objective-C must not just allow an assignment assigning an NSArray* to an NSMutableArray* variable.
    The other way round is harmless: Anyone looking at a variable of type NSArray* would think the array cannot be modified and therefore won't try to modify it. If the actual object is an NSMutableArray, no harm is done."

  • How do I pass parameter to different portlet regions from another page?

    How do I pass parameter to different portlet regions from
    another page?
    I have a page that with two regions. Each region has a report
    that uses the same information to generate its report.
    Individually running the reports, I can use p_arg_names and
    p_arg_values to get what I want. However, when I run the page
    that has both portlets, my .show is gone and I cannot get it to
    use the p_arg_names, etc. Do you have any idea how to overcome
    this? Thanks for any help.

    How do I pass parameter to different portlet regions from
    another page?
    I have a page that with two regions. Each region has a report
    that uses the same information to generate its report.
    Individually running the reports, I can use p_arg_names and
    p_arg_values to get what I want. However, when I run the page
    that has both portlets, my .show is gone and I cannot get it to
    use the p_arg_names, etc. Do you have any idea how to overcome
    this? Thanks for any help.

  • How to find the arguments of a static method from the class file

    Hi,all !
    How to find the arguments of a static method from the class file? for example, when we meet a bytecode "invokestatic", how can I know the arguments of this static method?

    Hi,all !
    How to find the arguments of a static method from the
    class file? for example, when we meet a bytecode
    "invokestatic", how can I know the arguments of this
    static method?You mean
    1. The values?
    2. Argument names?
    3. Argument signatures.
    I would suppose for the last that the easiest way would be to parse the signature string.
    The first is not possible - not from the class file.
    The second is only in the debug information stored in the optional part of the class file. And figuring out the format for that is going to be a problem.

  • How can i pass the  parameter for strored procedure from java

    dear all,
    I am very new for stored procedure
    1. I want to write the strored procedure for insert.
    2. How can i pass the parameter for that procedure from java.
    if any material available in internet create procedure and call procedure from java , and passing parameter to procedure from java

    Hi Ram,
    To call the callable statement use the below sample.
    stmt = conn.prepareCall("{call <procedure name>(?,?)}");
    stmt.setString(1,value);//Input parameter
    stmt.registerOutParameter(2,Types.BIGINT);//Output parameter
    stmt.execute();
    seq = (int)stmt.getLong(2);//Getting the result from the procedure.

  • How To... Execute Planning Functions and Sequences from MS Office Ribbon

    Dear all,
    I am working with a SAP how to paper, which is called:
    How To... Execute Planning Functions and Sequences from MS Office Ribbon.
    It is working absolutely fine and I am pretty satisfied, but as you probably know "Control the visibility of a button based on the visibility of a related crosstab: the  button just disappears once the related crosstab is not located on the active sheet."
    This means, when I insert different queries in different crosstabs, only one crosstab will have my own created ribbon. Is it also possible to set another specific ribbon with other buttons for another crosstab? Can I change the macro, included in the appendix of the how to paper, regarding this issue?
    Thanks in advance!
    Kind regards
    Dominik Drebinger

    Hey Martin,
    thanks for your reply, but I solved the problem on my own. Unfortunately my colleague did not see that the crosstabs had to be defined differently.
    Like this:
    Label
    Screentip
    Msolmage name
    Crosstab name
    Copy Initial Aligned
    Copy Initial Aligned
    CacheListData
    SAPCrosstab1
    Copy Initial Aligned 
    Copy Initial Aligned
    CacheListData
    SAPCrosstab3
    Copy Initial Aligned
    Copy Initial Aligned
    CacheListData
    SAPCrosstab5
    The macro, provided by the HowTo, is therefore working perfectly fine.
    Thanks though
    Dominik

  • How to force SequenceFi​leUnload callback to run from within operator interface

    I need to force SequenceFileUnload callback to run from within operator interface arbitrary, with possibility to control execution flow.
    I.e. discarding object handle of execution object, which has client sequence file, which has SequenceFileUnload callback, causes it(SequenceFileUnload callback) to run. Unfortunately, after discarding execution object handle, it can be used to control execution flow(pausing, aborting, terminating).

    Thanks for the clarification. Here are the answers to your 3 questions:
    1) You can programmatically run any sequence (including callbacks) by using the TestStand API Engine.NewExecution() method.
    2) The Execution API object has several control methods for breaking, aborting, terminating, restarting, etc... All you need to do is obtain a reference to the Execution you want to perform one of these actions on and call the appropriate method on the reference. If you start the SequenceFileUnload callback with the Engine.NewExecution method, this returns a reference to the Execution object that you can call these methods on. If you don't use the NewExecution method, you can do a check in your UIMsg event handler for the StartExecution UIMsg event
    for an execution starting that is running the SequenceFileUnload callback, and simply manipulate the Execution reference the UIMsg contains as you see fit.
    3) To disable the SequenceFileUnload callback for a sequence file that is currently loaded. You can set the SequenceFile API object property "UnloadCallbackEnabled" to FALSE, and the callback will not execute for that file when it is unloaded unless you go back and reset the property to true before unloading. Note this property is reset each time you load the file.
    For more information on the TestStand API objects, methods, and properties discussed in this post, refer to the TestStand Programmer Help accessed through the Sequence Editor's Help >> TestStand Programmer Help menu selection.
    Jason F.
    Applications Engineer
    National Instruments
    www.ni.com/ask

  • How to pass arguments to a batch file from java code

    Hi
    I have a batch file (marcxml.bat) which has the following excerpt :
    @echo off
    if x==%1x goto howto
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; %1 %2 %3
    goto end
    I'm calling this batch file from a java code with the following line of code:
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat");
    so ,that invokes the batch file.Till that point its ok.
    since the batch file accpets arguments(%1 %2 %3) how do i pass those arguments to the batch file from my code ...???
    %1 is a classname : for ex: gov.loc.marcxml.MARC21slim2MARC
    %2 is the name of the input file for ex : C:/Downloads/Marcxml/source.xml
    %3 is the name of the output file for ex: C:/Downloads/Marcxml/target.mrc
    could someone help me...
    if i include these parameters too along with the above line of code i.e
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat gov.loc.marcxml.MARC21slim2MARC C:\\Downloads\\Marcxml\\source.xml C:\\Downloads\\Marcxml\\target.mrc") ;
    I get the following error :
    Exception in thread main java.lang.Noclassdef foundError: c:Downloads\marcxml\source/xml
    could some one tell me if i'm doing the right way in passing the arguments to the batch file if not what is the right way??
    Message was edited by:
    justunme1

    1 - create a java class (Executer.java) for example:
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    public class Executer {
         public static void main(String[] args) {
              try {
                   for (int i = 0; i < args.length; i++) {
                        System.out.println(args);
                   Class<?> c = Class.forName(args[0]);
                   Class[] argTypes = new Class[] { String[].class };
                   Method main = c.getDeclaredMethod("main", argTypes);
                   // String[] mainArgs = Arrays.copyOfRange(args, 1, args.length); //JDK 6
                   //jdk <6
                   String[] mainArgs = new String[args.length - 1];
                   for (int i = 0; i < mainArgs.length; i++) {
                        mainArgs[i] = args[i + 1];
                   main.invoke(null, (Object) mainArgs);
                   // production code should handle these exceptions more gracefully
              } catch (ClassNotFoundException x) {
                   x.printStackTrace();
              } catch (NoSuchMethodException x) {
                   x.printStackTrace();
              } catch (IllegalAccessException x) {
                   x.printStackTrace();
              } catch (InvocationTargetException x) {
                   x.printStackTrace();
              } catch (Exception e) {
                   e.printStackTrace();
    2 - create a .bat file:
    @echo off
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; Executer %TARGET_CLASS% %IN_FILE% %OUT_FILE%3 - use set command to pass variable:
    Open MS-DOS, and type the following:
    set TARGET_CLASS=MyTargetClass
    set IN_FILE=in.txt
    set OUT_FILE=out.txt
    Then run your .bat file (in the same ms dos window)
    Hope that Helps

  • How can we pass argument to static block of code????

    hi ,
    My question is we can use static initialization block for having functionality like constructors for initializing static variable ,but we cannot pass arguments to static initialization block then how can I create functionality like parametrized constructors.Whats the alternative shall I use a static method to perform this functionality,since all methods in given class are static and
    there is no need of creating instance of class.

    jduprez wrote:
    Hello Jussi,Salut Jérôme
    That's probably a more maintenable design.
    However what do you base your remark on - I'm struck by the word obviously?
    Is there some design principle from which this advice so naturally ensues that it is obvious ?Yes I read my posting later on and thought about changing it, since it's not necessarily an obvious solution. I was making assumptions that I didn't clarify from the OP.
    In the OP's case, the "state" on which those methods operate is apparently fixed, presumably at the beginning of the program, so what's wrong with all this staticness?
    I can list:
    - threading issues (a non-issue after some initialization phase), that you wouldn't have with immutable instances
    - harder unit-testing (that's not an OO design problem, more a methodology problem)
    - mix and confusion between static and non-static state if the class ever happens to have both, in future maintenance. All good points, I see all-static classes as a "code smell" and especially in this case when there's parametrization involved.
    Now we just need to have the OP explain his situation a bit better.

  • How can I pass arguments from one MIDlet to another MIDlet

    Hi everybody !
    Can anybody help me in knowing that how can I pass the parameters from one
    MIDlets to another one in same application.
    I am devloping a application in which I am using more than two MIDlet and I
    want to transfer Parameter from one MIDlet to another one.
    I just explain what I have done....
    I made a MIDlet "A" and "B" in the same project using NetBeans IDE.
    In MIDlet "A" I create the Object of MIDlet "B" so that the constructor of
    MIDlet "B" is called and parameter can be transferred.
    But when I run the program it shows me two MIDlet on the screen, that I
    doesn't need.
    Suggestion are most welcome....
    Thanks in advance
    Regards
    Bhagwat

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • How do i read the Shift register value of a vi which is written in the teststand sequence from labview exe

    Dear All..
    My Qusetion is ... I have a VI in which I can writ the data to shift register and I can read( Differenent cases). I am Running the VI in write mode to write SAY '100' in the shiftreg( VI will be In teststand Sequence) . And I am reading the VI in read mode using Labview. I am getting the data in labview.
    When i conver my Reading Vi which is having that Read/Write vi in to EXE even then the test stand is writing the data to VI is Unable to reflect in labview.
    Please Help me out with some solution.
    Thanks
    bhargav

    I'm confused by your question:
    Are you trying to transfer data from an Exe to TestStand and vice versa?
    Or are you changing existing, working VIs into EXEs and then wondering why they won't behave the same?
    Can you clarify some what your goal is?
    There may be a better way to do what you want.
    Thanks,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How shall i pass argument to a servlet?

    hi friends,
    I need to pass a string variable to a servlet and then store it to the database.
    Is there any method to store it from j2me?
    -Thanks
    Kannan

    check out networking tutorials, web services tutorials from sun
    http://developers.sun.com/techtopics/mobility/allarticles/

  • Passing information between parallel Teststand sequences.

    The ExecutingCodeModulesInParallel example that came with Teststand 3.0 almost does exactly what I want. The example uses steps that run CVI. I am trying to create a LabVIEW equivalent of this example. Basically, I want a LabVIEW Display panel 1 to write to FileGlobals.Counter1 and a LabVIEW Display panel 2 to read from it during parallel execution.
    Right now, I can’t seem to get the information to pass between the two displays.
    Once I figure out how do this, I believe I will be able to apply it my specific task.
    I’m a newbie when it comes to Teststand and LabVIEW. Any help would be greatly appreciated

    Hi,
    The problems is your VI loops dont actual set the FileGlobals.Finish1 boolean and Counter1 until the stop buttons are press by which time you probably have missed them and like wise your other VI only reads the TestStand variables when the VI is launched.
    You need to call the PropertyObject.SetValBoolean method either by using the appropiate VI from the Teststand palette or via the Invoke node. In the other VI you will have to call the PropertyObject.GetValBoolean method and GetValNumber method. This also means you will need to pass the SequenceContext to both VI's.
    Have a look at the original example again and you will spot the relavant calls in the two C functions.
    I will post you your modified VIs later today.
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

Maybe you are looking for