Sign in to follow this  
jhenise

find and replace

Recommended Posts

for editing in sequences and edit boxes a find and replace feature would be nice...

helpful for editing a lot of redundant code where a number or name needs to be changed in many places...

Share this post


Link to post
Share on other sites

You mean across all, not just one sequence I'm assuming since that already exists.

BTW: it's generally considered good coding practice to avoid "magic numbers".  These are numbers that you might want to change in many places.  Instead you should use DAQFactory's define to create a name for your constant.  Then you can just change that in one place.  So for example:

define NumberOfTanks = 4
define string AppName = "My App"

You can then use these anywhere you would use a variable, except on the left side of an equal sign, or any other place where it would be changed.  The only way to change a defined variable is to define it again.

 

Share this post


Link to post
Share on other sites

I can hit ctl+F within a sequence and it opens the  find feature, but I don't see any replace option....

Anyway its not to big of a deal, i realized that you can just paste the script into Microsoft word and use the find and replace features in there...

What brought this up was I had mad an application with 20 temperature channels, and had written some long sequences to do things with them. I then make 20 humidity channels and duplicated  the sequences  to have the same functions for the humidity channels. this resulted in me having to change the word Temp to Humid in about 100 places in the scripts. just using the word processor made it super easy.

I could have made a private string within the sequences for the names perhaps if i was thinking ahead.

thanks for the input....

 

 

Share this post


Link to post
Share on other sites

Replace is in the Edit menu with Find and has a shortcut key of Ctrl-H.  I'm not sure why that shortcut was chosen, but I believe it matches up with an old version of Word, or maybe the Visual C++ editor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this