New object VI - constant variant [VI script]

Hello world

I write very important program for me and I have a problem.

I use the script VI component and I'm trying to generate constant Variant. I use the special function as new object VI to this task. This very simple look, but...

This implementation returns "error 1054 occurred at the new VI object in Main.vi. "Possible cause: the specified object is not found.

I think that the 'permanent' class for variant is good. The owner of the variant must be cluster. I tried to change ownership for example block diagram, but this isn't a job too.

Maybe someone can help me solve this problem?

I'll be very gratefull.

If you run the code with the as generic class, you will see that the variant is actually a control. I don't know if there is a way to create a constant directly, but in the script, there are often two ways to do what you want:

  1. Do what you what you would do manually. In this case, you can create the variant as a control, get its reference Terminal and which gives the word to change at constant method.
  2. Create a VI that already has the code you want (in this case a constant variant), then only open VI and copy / paste its code in the place wherever you want it to be. This is useful if you want to make a long series of script particuarly.

Tags: NI Software

Similar Questions

  • HOWTO return a new object of a script object

    Hello

    I wonder about the fact that it is not able to return a new object from an existing script object in a field of LiveCycle Designer.

    Let's say we have follwing situation:

    1. a Script object named 'LcdObjects' with a 'field': object

    function Field(som) {
     this.som = som;
     
     this.hideField = function() {
      som.presence = "hidden";
     }
    }
    

    2. now I want to create a new instance of the object of 'field' in a text field (in the case of 'click'):

    f = new LcdObjects.Field(this);
    f.hideField();
    

    3. the code above doesn't work with the text field. It seems that there is no new object created.

    4. it seems that I must create an auxiliary function for each object in the script object to get a successful return of a new object:

    function newField(som) { 
        return new Field(som); 
    }
    

    5. with the auxiliary function, I can create a new instance of the Field object in my text field:

    f = LcdObjects.newField(this);
    f.hideField();
    

    But I'm not very happy with this solution, because with this workaround, I have to create an auxiliary function to return for every single object which does not seem to be very smart to me.

    Are there any general solution to return an instance of an object without using this kind of workaround?

    Thank you.

    Hello

    You can add a function to a script object that returns your "Field" object with the method hideField. So, as a function;

    function Field (field)

    {

    var that = {'field': field};

    that.hideField = function()

    {

    This.Field.Presence = 'hidden ';

    }

    Back to this;

    }

    Could be called by

    LcdObjects.Field (TextField1) .hideField ();

    Concerning

    Bruce

  • Help! How do you keep objects in the same order in a doc page 20, when inserting a new object?

    I created a catalog of photos only, as objects.

    They are organized in alphabetical order, 4 images per page as a 2 x 2 grid, 20 pages.

    I want to insert a NEW object (image) in the middle of these 20 pages, and you want all objects after the move more than a place to make room.


    How can I get the objects after those inserted to shift, such that the text would be the case if you have inserted a text more in the middle of a paragraph?

    I can't understand how this (without just putting the images in a text box and online, but then I lose all the controls of the space)...

    Thank you!

    Laurent

    The only possibility would be a script. Scripting InDesign

  • The tool using pen to draw a new object over an object

    If I use the tool pen to make an object and then pass this object to another location. Then go to start a new object on top of that we're the first anchor point pen tools will start where was the original location of the objects. If I had to make a new object on another object, it's starting the anchor to this place. But if you start an object existing on the first anchor point is waaaay off to wherever was the original location of objects. I tried almost every parameter and you can not solve the problem.

    Use another layer to create a different object.

  • I have a script that ended up saving a file under a new name whenever I generate the script.

    I have a script that ended up saving a file under a new name whenever I generate the script on the same image.

    Moving to Scripting Photoshop

  • I want to create new sequence from a clip using script.

    I want to create new sequence from a clip using script.

    You can pop the dialog box new sequence (which requires interaction from the user to confirm the name of sequence), or create a new sequence from a .sqpreset file (and specify the name); There is no API around the feature 'make a sequence corresponding to this project item', available in the project Panel.

  • Place new objects above a last active?

    Hello

    I use Illustrator for years, but I've yet to understand how to create new objects just above the selected last high of absolut instead of the layer (or a clipping path, draw the fate-inside mode).

    I want to click on an object anywhere in my layers, and then draw a new path or dreate a form just above this one, as it works in photoshop with the new layers.

    I know that you can cut out the object and place it manually via ctrl-f, but it is really heavy and slow.

    Does anyone have tipps how can I solve this problem or a workaround?

    Simply double click the object you want to draw to.

    You will enter the Isolation Mode,

    Draw something and press ESC to exit the Mode of insulation.

  • Hi, I have 4 of Lightroom, but it does not support the new objective of pd 10-30 for my Nikon 1. It is supported in LR5. Can I download the profile of this lens and install in LR4?

    Hi, I have 4 of Lightroom, but it does not support the new objective of pd 10-30 for my Nikon 1. It is supported in LR5. Can I download the profile of this lens and install in LR4?

    Wow! It worked! Thank you very much! You just saved me buying a new verion of Lightroom (which is of course why Adobe does not update these profiles automatically).

    Thank you very much!

  • No transparency on a new object?

    I just updgraded to Illustrator 10 all the way to CS6 semi-force, and I notice some things that seem behanve differently. I don't know if they are 'normal' or not, but if anyone can suggest a way to change, that would be fantastic.

    The key is transparency. When I select an object that is transparent to 50% and then select the pencil and drawing early, the new object resulting has all of the appearance of the old object - line color, thickness of the line, the fill color - but NOT transparency. It always shows 100% opaque. I have to go, then select the transparency of 50% for each object, that I draw, which can be many things.

    Is there a setting that will allow new objects to "hold" the transparency of the selected object setting previously? Or should I really manually change the transparency of each after drawing it?

    It should keep transparency affecting as well.

    Make sure that ' appearance > new artwork has basic appearance is disabled. "

    Have you tried to save the original settings as a Style to see if the settings are retained by selecting the style?

  • New object Vi - replace table subset, resize and son Script

    Hi all

    I can create a subset of table replace.

    My problem is:

    I have what it takes to resize it (add more inputs) and wire the in and outputs.

    Pls help!

    I want to generate semthing like this:

    There are two methods of the class GrowableFunction, AddChunk, and RemoveChunk, which can be used to add or remove entries X pieces from the top or the bottom of the node.

  • Decimal rounding everything by creating a double when constant digital VI Scripting

    Hi guys,.

    First post here, so please excuse any misstep. I'm using LabVIEW Professional Development System 2013 SP1 on a Windows 7 computer; I'm kinda new to LabVIEW, but have a good background in other programming languages. I recently stumbled on VI Scripting and have been playing with it. As the title says, I had a hard time creating decimal numeric constants whose values are not rounded. It seems to me that when I pass the double (42.1) to the property node, it somehow gets cast in full. I tried to adjust the value of AdaptToEnteredData to true, but I think it doesn't affect the digital object in the newly created VI (output). It seems that the problem is how pass the numerical value for the property node in the original VI, but I don't really know how else to do in addition to the way I presented.

    Please let me know if there is any other necessary information and thank you for your help!

    Sebastian

    Property nodes run from the top down. Move the representation above the Value property property.

    Lynn

  • ActiveX - Word - casting of the objects to the variants

    Hello

    I'm just getting used to the use of Active X to automate the tasks of MS Office. I have the full suite and report generation tool does some things, but there are many others that I have and I give X a go Active (that's basically what NOR do anyway).

    I have problems with some of the methods they have a variant of entry type, but no one tells me what is the format of the Variant. For example, I give you this VI which seems to add a caption to an image. I see the following documentation from Microsoft, which tells me that:

    Documentation of the method

    Label
    Type: System.Object

    Required object. The legend label must be inserted. It may be one of the WdCaptionLabelID constants.

    Title
    Type: System.Object

    Optional object. String to be inserted immediately after the caption (ignored if TitleAutoText is specified).

    http://msdn.Microsoft.com/en-us/library/Microsoft.Office.Interop.Word.range.InsertCaption%28V=Office...

    -So, I should get my variant such as "System.Object" (?). I could probably assume that the title is just a simple string, but where would know that officially? My guess will fail eventually.

    Enum for type of legend:

    http://msdn.Microsoft.com/en-us/library/Microsoft.Office.Interop.Word.WdCaptionLabelID%28V=Office.15...

    -J' tried casting as a string and a number, or work (I guess an enum is a number, I tried 0,1,2)

    Any help would be appreciated, even if this can be more Microsoft is not to document their structure of objects that the problem of NOR, we are working towards the same goal! It is possible that there is another mistake as to why this program does not work, but I still need the General method...

    Note that you must have an input file specified to make the program work.

    Thanks for your help,

    Rik

    rik_aspinall wrote:

    (4) catch on the .NET support. The limitation was not good advertising.

    (5) words, Interop, ActiveX, .NET and COM all seem to be things that make this technology works. In addition, .NET looks like he's trying to keep old technology goes, which is worrying for the long-term support. The fact that nobody does this simple and well documented as a solution means that I'll ask an open-ended question: this feature/technology becomes obsolete, and if so, what will replace it and when?

    Thanks to tyk007 and bob for your help!

    Rik

    COM Interop in LabVIEW execution is tedious for a number of reasons - mainly because of the architectural design of many COM components. Their well-designed components are loosely coupled, but this often means a lot of calls on many objects - many of whom often optional parameters. My suggestion is to use a wrapping to LabVIEW .net is necessary. It is not that it is not possible to apply directly in LabVIEW (obviously), but you need a lot of infrastructure in your code to make sure that you don't lose that same coupling or, more importantly still, readability in your own extension of LabVIEW.

    In your scenario, I would ask myself: is this interface that I am building a long-term solution or a code that I am likely to change often? If Yes, then you could encapsulate COM Interop calls, and actually create a façade allowing the final user (eg. LabVIEW) functionality you need via an interface determined, without exposing the interchangeable parts (COM Interop). However, you must be comfortable said creation .net assembly that can be intimidating if you don't have the experience.

    http://en.Wikipedia.org/wiki/Facade_pattern

    As future support goes - it's a really, really good thing that .net helps keep these old technologies going. Long term support becomes a growing concern for these markets (read - more commercial rather than consumer solutions) and there are millions of apps out there running currently running one of these technologies. It's one of the reasons why I have recommended to you than a façade may be the best solution in the long term - there is always a desktop API. A front will always provide the same interface, whatever it is, if the calling code is not affected when the fact of the way that you interface API.

    PS: Windows 8 exposes the WinRT Basic programming framework, which is based mainly on the... COM I don't see not its predecessor going anywhere for many years yet.

  • From 'constant' by action script .jsx

    I have a script that opens a number of model files so that the content can be pasted in one of the many files. I'm the batch processing of these files with actions (one for each model), but I wish I could spend the necessary specific model for the script without requiring user input.

    That might require clarification.

    I have three folders of images, 'red', 'blue' and 'green', each containing 1000 images.

    I want to run the 'Reds' actions on all images of 'red', 'blue' actions on all the images in 'blue' and 'green' actions on all the images in 'green '. In all actions, I want to open the respective model, in order to 'red', I want to open the model of 'red', in the 'blue' etc 'blue '. I appreciate in this simple example, I could write just three scripts with hard-coded paths, but I really twelve actions currently and the potential for it to develop.

    My original idea was the relevant action to enter text, for example a text box with the word 'red', which can then be picked up in the script as a variable, but unfortunately the actions do not have a text entry.

    I looked in the variables, but I don't see how I can do that there is here.

    I also watched as symbols using pre-generated text strings, but I had real difficulties to get the action to choose the right channel.

    I was wondering also to have another document open in the background containing the text I need box, but I can't action to select an object in another document.

    Using the Clipboard is impractical because it is used for other things in action.

    Is there a solution to this, or am I resigned to writing several scripts? For information I am currently using CS5.

    StampyTheElephant wrote:

    the actions do not allow a text entry.

    You can pass a string custom in action via attributes > feature Notes, but you can also create a new layer with a custom, name that can also be used as a marker. To develop on the advice of Carlos, we can not even have points 'a' art in the document in a first time, you can add items of temporary art and assign their notes to be read by a script, and then these temporary items can be deleted later as well.

  • Precomposer new function AE CC via the script

    As we know new AE CC got awesome box called "Adjust duration of both extended the selected layer composition".

    The default setting in the script guide is:

    [object LayerCollection] .precompose (array, string, [bool]);


    But it does not work with a new checkbox.

    So how to operate with a new checkbox via the script?

    Thanks for reading.

    I found that precomp function does not work with app.project.activeItem.selectedLayers;

    So here's the finishing touch that works with selected layers.

    See you soon

    
    function precompLayer() {
    var myComp = app.project.activeItem;
    if(myComp == null){alert("Please, select your composition"); return false;}
    
       var selectLayers = app.project.activeItem.selectedLayers; // selected
       if(selectLayers.length <1 ){alert("Please, select layers"); return false;}
    
       myLayers = [];      // precomp function works only with layers indexes, so array should contain layers indexes
    
            for (var l = 0; l< selectLayers.length; l++){
                myLayers.push(selectLayers[l].index);            // new array with layers indexes
            }
    
     var precompIndices = myLayers;  //change this to customize
            var precompName = "new_comp";  //change this to customize
            var parentComp = app.project.activeItem;  //change this to customize
            clearOutput();
            writeLn("Creating precompose");
            app.beginUndoGroup("Precompose");
            var Inpoint = 0;
            var Outpoint = 0;
    
            var precomp = parentComp.layers.precompose(precompIndices, precompName, true);
            var adjustStartTime = precomp.duration, newCompDuration = 0;
            writeLn(precomp.layers.length+" layers in procompose");
    
            for(var i=1; i<=precomp.layers.length; i++) {
                var layer = precomp.layer(i);
    
                (Inpoint > layer.inPoint) ? Inpoint = layer.inPoint : Inpoint;                  // begin of precomp
                (Outpoint < layer.outPoint) ? Outpoint = layer.outPoint : Outpoint;       // end of precomp
    
                var duration = Outpoint - Inpoint;
                adjustStartTime = adjustStartTime > layer.inPoint ? layer.inPoint : adjustStartTime;
                newCompDuration = newCompDuration < duration? duration : newCompDuration;
            }
                writeLn("New duration = "+newCompDuration);
    
            for(var i=1; i<=precomp.layers.length; i++) {
                precomp.layer(i).startTime -= adjustStartTime;
            }
    
            precomp.duration = newCompDuration;
            parentComp.layer(precompName).startTime = adjustStartTime;
            app.endUndoGroup();
    
    writeLn("Done!");
    }
    precompLayer();
    
  • DBT instantiation of the object using constant variables

    Hello

    I use bdb 4.7.25 on freebsd 7.

    Here is my code snippet:

    -----

    Sub
    set ( const char * pData) {}
    ...
    TODO: Paths of unnecessary duplicates should be optimized.
    size_t dataLen = strlen (pData);
    char * dataBuffer = new char [dataLen + 1];
    strcpy (dataBuffer, pData);

    DBT key (& pKey, sizeof (unsigned long long)), given (dataBuffer, dataLen + 1);

    DbTxn * txnobj = NULL;
    env_.txn_begin (NULL, & txnobj, DB_TXN_NOSYNC);
    try {}
    DB [writeIndex]-> put (txnobj, & keys and data, 0);
    txnobj-> commit (DB_TXN_NOSYNC);
    } catch (...) {
    txnobj-> abort();
    }
    Remove dataBuffer;
    }
    -----

    Since then, the rest of my application, I use string c ++, I can get data as a const char *.

    And to put the data in BDB or tree B +, I'll need object Dbt, which accepts the char * only. So, I have to copy data unnecessarily and to free the memory allocated for each investment transaction.

    How we optimize it? How can we instantiate Dbt object using variables constant to use for the operation of investment on DB. "put" operation do not object of Dbt need to get the update, so it should there have supported the API for constant variables.

    I hope my question is clear and simple.

    You can do a 'const_cast(pData);"

    DB::put will not change your data in all cases. If you need to make sure that the block of pData memory is not accessible by other threads/processes during the Db::put operation.

    David

Maybe you are looking for