GObject : Replace Method

Hello. I am working with labview scripting in order to create a script that will replace all selected indicators with an indicator from a ctl file. However, I can't seem to figure out the GObject method "Replace". Attached is my current script. I was wondering if anyone could let me know what I am doing wrong or if what I am trying to do is even possible. Thanks.
Solved!
Go to Solution.
Attachments:
IndicatorReplace.png ‏17 KB

A few tips.
It looks like you are using the selection on the BD, therefore the objects you find will be ControlTerminals.  You need to get the corresponding Control property and call its replace method.
To handle this, and allow for other random objects in your selection I would use To More Specific Class to cast each object to a ControlTerminal.  If there is no error, then get the Control Property and call the replace method.  If there is an error, simply do nothing.  This way if there is a wire or two in the selection you are ok.
It also appears that you are using this from the Tools Menu, which is cool.  You can add a check of the VI.FPIsFrontmost property to detect if you are calling from the FP or BD.  If it is the FP, you can simply cast everything in the SelList[] to a Control and for the successful ones call the Replace method.

Similar Messages

  • Why does a find and replace method remove whitespace?

    I have method that searches for a string in a FM document and replaces it with a variable. If for example, there was a string foobar that I wanted to replace with the variable barfoo. Then, I expect this text:
    Lorem ipsum dolor sit amet, foobar consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    To be changed to this text:
    Lorem ipsum dolor sit amet, barfoo consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    However, while the text does do the replace it also removes the whitespace between the variable and the text that appears right after the variable so it actually looks looks like this:
    Lorem ipsum dolor sit amet, barfooconsectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    Why is the find and replace method removing the whitespace and how do I prevent that from happening? The method is provided below.
    function FindAndReplaceString(pDoc, findString, replaceVariable)
        if (typeof pDoc != 'undefined'&&typeof findString != 'undefined'&&typeof replaceVariable != 'undefined'&&pDoc.ObjectValid()&&findString.length>0&&replaceVariable.length>0)
            var vVarFmtStatus=checkVarFmStatus (pDoc, replaceVariable);
            if (vVarFmtStatus=='In Doc')
                var tr = new TextRange();
                var findParams = new PropVals();
                var frame = pDoc.MainFlowInDoc.FirstTextFrameInFlow;
                var restoreTR = pDoc.TextSelection;
                tr.beg.obj = tr.end.obj = frame.FirstPgf;
                tr.beg.offset = tr.end.offset = 0;
                findParams = AllocatePropVals(1);
                findParams[0].propIdent.num = Constants.FS_FindText;
                findParams[0].propVal.valType = Constants.FT_String;
                findParams[0].propVal.sval = findString;
                tr = pDoc.Find(tr.beg, findParams);
                var vLoopCounter=0;
                while(FA_errno === Constants.FE_Success&&vLoopCounter++< 1000)
                    pDoc.TextSelection = tr;
                    pDoc.Clear(0);
                    var newVar = pDoc.NewAnchoredFormattedVar(replaceVariable, tr.beg);
                    var varLength = newVar.TextRange.end.offset - newVar.TextRange.beg.offset;
                    tr.beg.offset += varLength;
                    tr = pDoc.Find(tr.beg, findParams);
                if (vLoopCounter>0)
                    Log (vLogFileName, 'In the document \''+pDoc.Name+'\', the string \''+findString+'\' was replaced with the variable \''+replaceVariable+'\' '+vLoopCounter+' times.\n')
                if (vLoopCounter>1000)
                    recordErrors (vErrorLog, 'ERROR: In the document "'+pDoc.Name+'", the find and replace operation was stopped after executing '+vLoopCounter+' times. The term being searched for is "'+findString+'" the replacement variable is "'+ replaceVariable+'".')
                pDoc.TextSelection = restoreTR;
                pDoc.ScrollToText(restoreTR);
                } else {
                    recordErrors (vErrorLog, 'ERROR: The find and replace operation failed because the variable '+replaceVariable+' does not exist in the following doc: '+pDoc.Name)
            } else {
                recordErrors (vErrorLog,'Invalid or unitialized parameter passed to function FindAndReplaceString')

    Hi,
    Not at the moment. Please post in http://forums.adobe.com/community/muse/ideas so other users can vote on the feature request.
    Thanks,
    Abhishek

  • Need replacement method for FM: REUSE_ALV_GRID_DISPLAY.

    Hi
    i need a replacement method for FM: REUSE_ALV_GRID_DISPLAY from the class CL_GUI_ALV_GRID,
    kindly let me know if someone knows the solution for it.
    regards
    mano

    Method set_table_for_first_display, look at [ALV Grid Control (BC-SRV-ALV)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]
    Regards

  • Understanding Regex replace method call involving delegate

    Hello,
    I am trying to understand the $regex.replace static method call below (I came across this code snippet in the cookbook).
    $replacer = {
    param($match)
    $chars = $match.Groups[0].Value.ToCharArray()
    [Array]::Reverse($chars)
    $chars -join ''
    $regex = [Regex] "\w+"
    $regex.Replace("Hello World wide", $replacer)
    What I do not understand is the below overloaded definitions for replace method do not seem to match the above replace call. So how exactly is this working? The above call has 2 parameters passed where as none of the below overloads have less than
    3 parameters.
    PS C:\WINDOWS> [regex]::replace
    OverloadDefinitions
    static string Replace(string input, string pattern, string replacement)
    static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options)
    static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options, timespan matchTimeout)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options, timespan
    matchTimeout)

    What you are looking at are the static methods ([regex]::) and their appropriate parameters which in this case have a minimum of 3 parameters to properly perform the Replace using the input, pattern and replacement
    value. If you were to use the constructor of [regex] to create a pattern like this:
    $Regex = [regex]'\w'
    You will see that the Replace method here allows for only 2 parameters because you have already satisfied the pattern when you created the Regex object.
    $Regex.Replace
    OverloadDefinitions
    string Replace(string input, string replacement)
    string Replace(string input, string replacement, int count)
    string Replace(string input, string replacement, int count, int startat)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count, int startat)
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • SCCM Replace method migration for XP-to-W7 without creating computer associations?

    Hi all
    We want to use the Replace Method for our XP-W7 migration but do we have to create a computer association between the old and new machine name for every machine to be migrated (2500+)? If so, this does not appear to be practical because we don’t know what
    the new machine name will be for every old machine to be migrated until we image machines with Windows 7, which is likely to be on the same day.
    So, how can we use the Replace Method without creating computer associations please?
    Best regards
    Scott

    MDT 2012 SP1 is integrated with ConfigMgr 2012.
    We are testing a UDI solution, however, when we click “Preview” on the Refresh stage group we get the error “Unable to launch wizard in preview mode – OSDSetupWizard.exe was not found in the expected path”.  This is preventing us from
    checking that the changes we have made to the capture/restore settings will work or not. This error does not occur when we "Preview" the NewComputer stage group and we have checked OSDSetupWizard.exe does exist in \\<server>\MDT Toolkit\Tools\x64
    and \\<server>\MDT Toolkit\Tools\x86.
    1. How do we overcome this error to allow us to preview the Refresh stage group please?
    2. Do we need to specify the DEPLOYMENTTYPE variable in the customsettings.ini and if so, do we need 3 different customsettings.ini files for each scenario (DEPLOYMENTTYPE=NewComputer, DEPLOYMENTTYPE=Refresh and DEPLOYMENTTYPE=Replace)?
    Kind regards
    Scott

  • E-REC - WebDynpro Exception: Subclass of must overwrite/replace method

    Hi All,
    We are encountering an issue with an E-Recruiting web dynpro, hrrcf_a_candidate_registration, all of the sudden throwing the below error message:
    - WebDynpro Exception: Subclass of must overwrite/replace method
    Any thoughts/ideas would be helpful.
    Thanks!

    Hi Dhinesh,
    We found the following note:
    Note 1108840 - Error message when
    using browser that is not supported
    Regards,
    Nathan

  • Beginner Java: Replace method solved

    Hi all,
    Having some issues in java, decided to take an intro to programming this semester
    I want to use the replace method to replace multiple integers with characters,
    public class ReplacementTester
    public static void main(String[] args)
    String greeting = "H3770, 371t3 hack3r!";
    // your work here
    // call the replace method four times
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    I think I need to use
    String modifiedGreeting = greeting.replace("7", "l");
    in there, which works, but I don't know how to continue it to put more replacements in it. I cant seem to use the same argument again like this, it seems to ignore the second line.
    String modifiedGreeting = greeting.replace("7", "l");
    String modifiedGreeting = greeting.replace("3", "e");
    I know I gotta be missing something relatively simple,
    Any ideas?
    Last edited by proxima_centauri (2009-01-15 22:33:45)

    You keep recreating the modifiedGreeting reference, so the previous String objects stored their (edit: there) get deleted. I haven't used Java in a long time, but assuming your description of the replace method is correct, the following should work:
    public class ReplacementTester {
    public static void main(String[] args) {
    String greeting = "H3770, 371t3 hack3r!";
    String modifiedGreeting = greeting.replace("7", "l");
    modifiedGreeting = modifiedGreeting.replace("3", "e");
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    or to be more concise:
    public class ReplacementTester {
    public static void main(String[] args) {
    String greeting = "H3770, 371t3 hack3r!";
    String modifiedGreeting = greeting.replace("7", "l").replace("3", "e");
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    Last edited by dsr (2009-01-15 21:44:55)

  • What is the replacement method for preventDefault() on iOS?

    Using preventDefault() in response to orientationChanging is a well-documented technique for preventing rotation on iOS. What is the recommended replacement method for this call when manually managing device rotation events?
    From the release notes: preventDefault() is not honored for the ORIENTATION_CHANGING event on iOS. This is a behavior change from AIR 3.4 and will remain so. (3324338)

    Auto-orientation has drastically changed in iOS 6. Some of the auto-orientation callbacks have been completely deprecated in iOS 6. This change affects the screen orientation API's in AIR too and support for the new callbacks have been added in AIR 3.5 beta release. The deprecated callbacks informed the application about the new orientation it was being rotated to. Hence, application could decide whether it wanted to rotate to the new orientation or not. However, the new callbacks do not give us such information. The application is only queried about what orientations are currently supported. If this value returned by the new callbacks matches the new orientation stage is being rotated to, the stage automatically rotates. Otherwise it does not. As a result of this limitation of the new callbacks, support from preventDefault() was deprecated on iOS in AIR 3.5(built with iOS 6 SDK). The application will still receive the ORIENTATION_CHANGING event. But calling preventDefault() inside the ORIENTATION_CHANGING event handler won't prevent the stage from being rotated to the new orientation. It is important to note that apps packaged with iOS 6 and running on iOS 5.1 devices or lower will also see this behavior change of not able to control auto orientation by using preventDefault(). This was done to make this change consistent across iOS devices.

  • XML replace method

    Hi,
    I have a section of an XML which I'd like to replace.  I'm using this method however it won't work.  Although both strings (myString & mystring2) are giving the expected results, the XML (XML2) remains the same after I use the replace method.  Any ideas how I can go about this? Thanks
    trace ("Relevant XML part to change: ")
        var xnList:XMLList = MovieClip(root).myXML2.*.(@label== MovieClip(root).combobox.selectedItem.label);
        var mystring2:String = xnList;
    trace ("New string: ")
        myString = myString + "\u0009" + "<Section label = \"" + "\u0009 </Section>";
    MovieClip(root).myXML2.replace (mystring2,myString);
        XMLString = MovieClip(root).myXML2;
        trace (XMLString);

    Actually both arguments of replace () are strings
    Well, the first argument needs to be the name of the node (or the index number of the node, or "*"), and the second argument needs to be an XML. You cannot pass an XMLList as a string
    You are basically adding a child node to a node. You can do so dynamically using E4X:
    var myXML2:XML = <requirements>
                        <Section label="P">
                           <Requirement_1>
                              <Name>P1</Name>
                           </Requirement_1>
                           <Requirement_2>
                              <Name>P2</Name>
                           </Requirement_2>
                        </Section>
                        <Section label="M">
                           <Requirement_1>
                              <Name>M1</Name>
                           </Requirement_1>
                           <Requirement_2>
                              <Name>M2</Name>
                           </Requirement_2>
                        </Section>
                        <Section label="C">
                           <Requirement_1>
                              <Name>C1</Name>
                           </Requirement_1>
                           <Requirement_2>
                              <Name>C2</Name>
                           </Requirement_2>
                       </Section>
                    </requirements>;
    var selectedLabel:String = "M";
    var n:uint = myXML2.Section.(@label == selectedLabel).children().length();
    var newNode:XML = new XML("<Requirement_" + (n + 1) + "><name>" + selectedLabel + (n + 1) + "</name></Requirement_" + (n + 1) + ">");
    myXML2.Section.(@label == selectedLabel).children()[n] = newNode;
    trace(myXML2);
    Trace
    <requirements>
      <Section label="P">
        <Requirement_1>
          <Name>P1</Name>
        </Requirement_1>
        <Requirement_2>
          <Name>P2</Name>
        </Requirement_2>
      </Section>
      <Section label="M">
        <Requirement_1>
          <Name>M1</Name>
        </Requirement_1>
        <Requirement_2>
          <Name>M2</Name>
        </Requirement_2>
        <Requirement_3>
          <name>M3</name>
        </Requirement_3>
      </Section>
      <Section label="C">
        <Requirement_1>
          <Name>C1</Name>
        </Requirement_1>
        <Requirement_2>
          <Name>C2</Name>
        </Requirement_2>
      </Section>
    </requirements>
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Need advanced "Find and Replace" method

    I have bunch of pages need "Find and Replace" work in html
    coding, but I can't use DW's "Find and Replace" function to do with
    it. Here's the sample code:
    quote:
    "<tr valign="top"><td align="center"><a href="
    ../photo/ccg/pages/Columbus Grill
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Columbus
    Grill M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Columbus Grill M</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Columbus Grill
    W_jpg.htm"><img src="../photo/ccg/thumbnails/Columbus
    Grill W_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Columbus Grill W</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Cookies Lounge
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Cookies
    Lounge M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Cookies Lounge M</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Cookies Lounge
    W_jpg.htm"><img src="../photo/ccg/thumbnails/Cookies
    Lounge W_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Cookies Lounge W</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Corcorans
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Corcorans
    M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Corcorans M</td>
    </tr>"
    You can see I need to use EVERY highlighted code to replace
    each NEXT bolded code, highlighted code are deffirent but bolded
    code are the same. Now I just do it manually, but there are
    thousands of them.
    Is any one has a better method using DW's "Find and Replace"
    function to do this job automatically?

    Using Templates with a 900 page site is a crime against
    humanity. You reach
    the optimal size for Templates between about 50 and 100.
    The error you are getting suggests that there are coding
    errors on the page
    (perhaps even unrelated to ANY DW Template markup). We'd need
    to see the
    page to make progress with what that might be, as Alan says.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "RyanWaters" <[email protected]> wrote in
    message
    news:ggs7fq$gnq$[email protected]..
    >I am a little green to this all. I am trying to find and
    replace a word
    >inside
    > the edit region and Dreamweaver will not change it,
    because it says its
    > inside
    > a locked region, but its a editable region?
    > I have about 900 pages I need to make this change on and
    was relying on
    > the
    > find and replace tool to do that. I tried differn't
    advanced options,
    > nothing
    > seams to change it. I am using cs3. Thanks for any help
    >

  • Interesting thing happening with document.location.replace("") method

    Does the JavaScript method document.location.replace("") expires the current session. It happened with me, but I am not very sure!!! Could anybody put some light on this point?

    Actually document.location.replace does load new URL, replacing entry in History

  • I need a replace method for a string buffer

    I am not a Java programmer but I have been working with programming languages for a number of years.
    What I have is some code that returns a hyperlink into a string buffer and then passes that buffer back to the web page that called it inserting the HTML so the page can be displayed.
    I need to replace certain characters in that variable prior to it being handed back to the web page.
    I was hoping for a code snippet that would like me do this.
    Can someone help?
    Thanks

    I am afraid the syntax is escaling me here.Time to brush up on your Java syntax then.
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com . A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoritative than this.
    Can you show me an example of how to incorporate it
    on an existing String Buffer?Do you know how to call a method on a String Buffer( Like say append)? Do you know how to do a loop?

  • Replacing method

    My assignment is : Write a method named "replace". This method should take three String values (text, searchValue, replacementValue). It should should look for searchValue inside text and replace each occurrence of it with the replacementValue. The method must return the resulting string. You should not use replace() and replaceAll() methods of String class.
    For example, if the text is "I love you very much and miss you very much", searchValue is "very" and replacementValue is "not so", then the method should return the following string:
    "I love you not so much and miss you not so much"
    public class Replacemethod
         public static String replace (String text, String searchValue, String replacementValue){
              int length = text.length();
              String replaced = " ";
              String delimiter = " ";
              StringTokenizer wordfinder = new StringTokenizer(text,delimiter);
              while(wordfinder.hasMoreTokens()){
                   String word = wordfinder.nextToken();
                   if(word == searchValue){
                        int position = text.indexOf(word);
                        String ending = text.substring(position + word.length());
                        replaced = text.substring(0,position) + replacementValue + ending;
                        return replaced;
              return replaced;
         public static void main( String[] args)
              System.out.println(replace("I love you very much and miss you very much","very","not so"));    
    } where am i doing wrong?

    darth_code_r wrote:
    flounder wrote:
    darth_code_r wrote:
    And i'd have used split instead of the tokenizer.I wouldn't use either. That method will not work if you want to replace ate in mate.Huh? Using split , you can replace ate in mate
    Yes you could but not the way OP has it coded. They are splitting the String and then comparing each "word" in the String with the replacement "word". Since "mate" != "ate" it will not get replaced.

  • JavaScript Replace Method

    Hello all.
    I am trying to use the replace javascript method to format a number, but with no success.
    If the string is '123.567.789'
    and I use x = x.replace(".", "$");
    I get: '123$456.789'.
    I mean, only the first occurence is replaced.
    Browsing the internet, I saw people using
    x = x.replace(/STRING/g, "NEW STRING");
    The funny thing is: it works with most characters, but not with single dots, like "."
    If I use x = x.replace(/./g, "$");
    I get '$$$$$$$$$$$'.
    All the characeters are replaced, not just the dot. How can I replace all ".", "/", "-" characters?
    Thanks in advance.
    Carlos Inglez

    Try
    x.replace(/[.]/g,"$")Regards,
    Shijesh

  • StringBuilder replace method query

    I have just joined the forum.
    I am attempting to search a password and replace a character with another character.
    e.g. password = "abcdlefg"
    partial code is:
    int startIndex = 0;
    int endIndex = 0;
    for (int i = 1; i <= password.length(); i++)
    startIndex = password.indexOf("l", 0);
    endIndex = startIndex + 1;
    password.replace(startIndex, endIndex, "_");
    return password;
    I'm getting the following:
    "Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1"
    But I don't understand why. Can anyone explain?
    Regards,
    Ewizard...

    http://forum.java.sun.com/thread.jspa?threadID=5273487&tstart=0
    Double posting butthole!
    Help provided in other thread. DO NOT REPLY HERE!

Maybe you are looking for

  • Some issues in OIM password generation and update OIM user profile

    Hi, I want to achieve the following 1) When user is created using recon:-- I want to generate the password for each user. As i can do this using entity adapter and by attaching it on pre insert tab. But i need to regenerate the password in case or re

  • How do I include stock market index on webpage?

    Hi, My client wants a webpage that has the index numbers of the Ney York stock Exchange, the DOW, The Nikkei, several European Stock Market Index, etc. Can anyone point me to a service that supplies this for a website? I expect there are apps/scripts

  • How to add a full column to a chart

    How can I add a full column of data in a table to the y axis in a line graph in Numbers?

  • Why do we need the HWM?

    hi, why do we need the HWM? Does the CBO use it? I mean, if we're doing a FTS, then the first unformatted block we hit in a MSSM tells us all blocks above it are unformatted, so we dont read anymore, so what is the use of the HWM? thanks

  • Newbie Creating A Massive Data Sheet - Help!!

    Hi everyone... I'm not the sharpest knife in the drawer, especially when it comes to data crunching. Here's the situation: I have about 40 locations. Each location has 5 - 10 agents that feed me leads. I need to keep track of: Monthly total # of lead