Click here to Skip to main content
Click here to Skip to main content

SmartReplace AddIn [VC 6.0]

, 23 Aug 2003
Rate this:
Please Sign up or sign in to vote.
Yet another replace dialog

Introduction

There already are some nice substitutions for the built-in replace dialog available, but none of them entirely satisfied my needs. This is why I've written yet another one.

This AddIn, in contrast to all others I know of, does the actual find and replace operation inside the DevStudio IDE, meaning that each file that gets scanned for replacements is acutally opened as a document. This way you can replace within serveral files and watch the result prior to saving them.

Installation

Simply put the binary into your %MSDevDir%\AddIns folder and enable it in the Tools | Customize | AddIns & Macros dialog.

Usage

The AddIn installs a toolbar icon. Simply click it or add a keyboard shortcut to its command to your profile.

New case option

Here is a brief description of the new option

All Cases

When enabled, the replace command replaces all three cases, i.e. as-is, lower-case and upper-case, of the find string with the same case of the replace string. For instance, if the find string is "Abc" and the replace string is "Def" then "abc" will be replaced with "def", "Abc" will be replaced with "Def" and "ABC" will be replaced with "DEF" while all other cases, e.g. "aBc", remain unchanged.

New replace locations

The new replace locations are enabled by selecting "Extended" in the "Replace where" group. Press the "Advanced" button to show the extended locations options. Here is a brief description of the new replace locations:

All open text files

Replaces all instances of the find string with the replace string in all open text documents.

All text files within current project

Replaces all instances of the find string with the replace string in all text documents belonging to the active project of the workspace.

All text files within current workspace

Replaces all instances of the find string with the replace string in all text documents belonging to either project of the workspace.

All text files in specified directory

Replaces all instances of the find string with the replace string in all files matching the filter provided by the "File Extensions" and "Directory" combo boxes. Check the "Recurse" option to extend the operatio to all sub directories.

All text files matching file and folder filters

Replaces all instances of the find string with the replace string in all files matching the filters provided by the "Filters..." dialog.

Global options

Press the "Options..." button to open the global options dialog

SmartReplace Options

Confirm

Here you can specifiy when to ask your permission for replacement. Available options are: Never, Each Instance, Each File and Each Project. The "Only ask in extended mode" disables the confirmation dialog for the "oridnary" replace locations "Selection" and "Current File".

Documents

Lets you specify when to save and close documents that got modifed during the replace operation. Available modes are: Always, Never and Ask.

File and Folder Filter

Lets you specify the folders and file filters to use with replace location "All files matching file and folder filters".

SmartReplace Filters

Known Bugs

See the ReadMe.txt for Known Bugs and ToDo list.

Implementation

The AddIn incorporates a yet unfinished light-weight DevStudio Automation Model Interface wrapper library that aims at speeding up AddIn Development. Perhaps you might find it useful for your own AddIn projects.

 Updates

SmartReplace 1.2

New Features

  • Added regular expression context menus (thanks to Daniel Beutler [chefsponk] for the code)
  • Moved DSWrapLib to a seperate project
  • SmartReplace 1.1

    New Features

  • Enabled "Regular Expression"
  • Added Browse For Folder Button
  • Browse For Folder dialogs now open at current directory
  • "File Extensions" can now be entered manually
  • "File Mask" now supports multiple filters (i.e. "*.cpp;*.h")
  • Bug Fixes

  • "Cancel"-hang fixed
  • "Continue" and "Replace" now stop atfer all instances have been enumerated
  • "Match Whole Words" now works in all modes execpt "Selection"
  • "Regular Expression" now works in all modes execpt "Selection"
  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    Share

    About the Author

    Roman Keskenti [SmoCoder]
    Web Developer
    Germany Germany
    No Biography provided

    Comments and Discussions

     
    GeneralProblems PinmemberRocketFuMaster17-Sep-03 5:54 
    GeneralRe: Problems PinmemberRoman Keskenti [SmoCoder]17-Sep-03 8:00 
    GeneralConfiguration Control Integration Pinmemberayreon5-Aug-03 22:30 
    GeneralRe: Configuration Control Integration PinmemberRoman Keskenti [SmoCoder]6-Aug-03 2:21 
    GeneralI like the design... PinmemberPaul Selormey2-Aug-03 17:58 
    GeneralFeatures Pinmemberokigan2-Aug-03 11:20 
    GeneralRe: Features PinmemberRoman Keskenti [SmoCoder]2-Aug-03 12:36 
    Thx for your reply.
     
    Yes, I confess there are still a few features missing and some bug fixes to do. I just posted it in this somewhat unfinished state to get some feedback. I'm already working on the Known Bugs (ReadMe.txt) and will re-post it when I've fixed them.
     
    If you find more bugs or have more feature requests, just post them here and I will add them to my list.
     
    - RegEx: I disabled the feature because it is not yet implemented. I inted to implement it as soon as all bugs are fixed.
     
    - Cancel: Yes, it's on the Known Bugs list.
     
    - Browse: Err, you're right: I simply forgot it. Will be available in next release.
     

    GeneralRe: Features Pinmemberokigan23-Jan-04 1:07 
    GeneralRe: Features Pinmemberokigan23-Jan-04 1:27 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web03 | 2.8.141220.1 | Last Updated 24 Aug 2003
    Article Copyright 2003 by Roman Keskenti [SmoCoder]
    Everything else Copyright © CodeProject, 1999-2014
    Layout: fixed | fluid