Jump to content

Using Find & Replace Dialog programatically


Fredxxx

Recommended Posts

Hello everybody,

my aim is to rename all different objects, nodes, constant, in a huge program, which have a specific prefixx ( f.e.. XX_ ) as Value or as label.

Normally i would use the find-dialogbox, search for the string "XX_" and replace it with the new rrefix (f.e. New_). But i have to do this with scripting programatically.

Does anybody know a function or a routine, which can do this?

Thanks a lot!

Greetz

Fred

Link to comment

Does anybody know a function or a routine, which can do this?

Here's the best way I know to find stuff anywhere in a VI; it's called TRef Traverse for References.vi. Feed it a VI reference and it will find every instance of the specified Class, no matter how deeply nested they are in various structures, which you can operate on as JG suggested.

I've attached an example (in two VIs) that you can try. Download them to the same directory and run shooter.vi; it'll find (by name beginning with "XX_") and rename the Boolean constant that is buried in a Diagram Disable Structure in an Event Structure in a While Loop.

post-7534-0-60353800-1292413600_thumb.pn

<EDIT> Added shooter/target example <\EDIT>

target.vi

shooter.vi

Edited by jcarmody
Link to comment

I played around a bit further hoping to make it more general by searching for GObjects instead of each specific type. I came up with this, but it requires adding cases for every type of object you want to address. Perhaps it's not the worst solution...

post-7534-0-31409500-1292938289_thumb.pn

Link to comment

I played around a bit further hoping to make it more general by searching for GObjects instead of each specific type. I came up with this, but it requires adding cases for every type of object you want to address. Perhaps it's not the worst solution...

post-7534-0-31409500-1292938289_thumb.pn

If you search for "Constant" on the class name you won't need a case for each type as they all have labels.

Link to comment

If you search for "Constant" on the class name you won't need a case for each type as they all have labels.

I used the Constant Refnum for Constant instead of BooleanConstant but didn't add all types of constants to the Case Selector. I could search for "Constant" in the Class Name, but I'd just be moving the Case Structure. The other cases include Control, Node, Wire, Control Terminal and While Loop. I'd like to make it generic without specifying every possible type. I'm stuck...

Link to comment

I used the Constant Refnum for Constant instead of BooleanConstant but didn't add all types of constants to the Case Selector. I could search for "Constant" in the Class Name, but I'd just be moving the Case Structure. The other cases include Control, Node, Wire, Control Terminal and While Loop. I'd like to make it generic without specifying every possible type. I'm stuck...

Ahhh. IC. Don't bother with PassaMak then 'cos it's mainly UI focused. You have to find the parent that has the attribute you want to cover as many types as possible. Unfortunately, you still have to cast, but you can reduce the cases required.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.