is there a program with scriptable or macro find/replace

0 favourites
  • 7 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • in my current project, I'm going to need to do the same sequence of find/replace on text over and over throughout the development project. Is there a program that allows you to automate this? it would be extremely useful right about now.

  • You could make a batch file and use commandline tools to do it. There are many different commandline tools you can use.

    This commandline utility looks pretty good:http://www.programmersheaven.com/download/41236/download.aspx

    Example batch file:

    @echo off
    rem seach and replace batch
    set myfile=main.cpp
    ssr 0 "birds" "cows" "%myfile%"
    ssr 0 "foo" "bar" "%myfile%"
    set myfile=
    [/code:1tc3vuwi]
  • not sure what you mean by macro and i might not be helping with what your asking but i know that word has a find and replace/replace all ect. thats pretty handy. again this might not be what you mean by macro :S

  • thanks quazi and rojo.

    I noticed after this post that notepad++ has a record macro feature, so I'll probably test that out first. [edit: nm, the macro recorder in notepad++ won't record find/replace actions, presumably because it only records what happens while the main program window is in focus[not the find/replace child window])

    but what I meant quazi, is I have to find and replace several things in a row, in a certain order, like

    Find "applesauce", replace with "butter"

    Find "apple", replace with "pear"

    Find "you", replace with "me"

    Find "bloodcell", replace with "nanobot"

    it's a long sequence of these, that I'll probably have to do a few hundred times before I'm done developing my current project. So it'd save me alot of time and carpal tunnel, if it was automated, and I just hit one key, and it did the whole process for me.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So like why not make an app in Construct?

    You could easily make something to load a text file, or copy pasta from the clipboard.

    http://sourceforge.net/apps/mediawiki/construct/index.php?title=System_Expressions#Text

    In particular:

    Remove(source, string)
        Removes all occurences of string within source [/code:221qxbve]
  • Depending upon what format your source text is in, Python can also make short work of such a problem. If you can import the text into a python string (or list of strings), or even paste it into a Construct EditBox object, you can do something like this:

    text = "one plus one equals two, and four minus three equals one."
    terms = [['three', 'five'],
             ['four', 'seven'],
             ['two', 'four'],
             ['one', 'two']]
    for find, repl in terms:
        text = text.replace(find, repl)
    print text[/code:2l3t03l5]
    
    ...which results in this:
    
    [code:2l3t03l5]two plus two equals four, and seven minus five equals two.[/code:2l3t03l5]
    
    There are some [url=http://docs.python.org/library/stdtypes.html#string-methods]pretty powerful string methods built-in to Python[/url]. You can even do this in Construct.
  • in my current project, I'm going to need to do the same sequence of find/replace on text over and over throughout the development project. Is there a program that allows you to automate this? it would be extremely useful right about now.

    lucid, I think, that JGsoft PowerGREP is what you are looking for. You may also try this - Funduc Search and Replace. Sorry, both are shareware. I believe, that there is a freeware program somewhere, but I don't know exactly.

    Suppose, it will help you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)