[eggPlant Functional] Find and Replace in Multiple Scripts

SenseTalkDougSenseTalkDoug adminForumAdmin admin
Here are some scripts that provide at least one possible answer to a common need: finding all of the scripts in a suite that use a particular image name, global variable, command, or function; and possibly changing those occurrences to some other name.

The two scripts in this suite will each search for some text in all of the scripts in a suite, or even across several suites at once. You may use them as is, or adapt them to your particular needs.

The FindInAllScripts script prompts you to select a suite (or several suites), and to enter the text to search for. It then opens every script in the selected suites which contains the search text.

The ReplaceInAllScripts script asks for some replacement text in addition to the search text. It also asks whether you would like to be asked about each script, in order to allow you to select which scripts will be changed. It then replaces every occurrence of the search text with the replacement text in all of the scripts in the selected suites or folders.

[Note to current beta testers: Due to a bug in the answer folder command in 4.1 beta 3, these scripts will terminate prematurely. Use an earlier version instead. This bug has been fixed for the final release of 4.1]

Comments

  • Awesome. I'm going to need this pretty soon!

    Now if we only had a spotlight PI for Eggplant... :D
  • Find and replace project-wide is not a big deal using tools designed with your needs in mind. Try TextMate, it is a light weight project management tool and may address your immediate needs until at some point EP version XYZ comes to the rescue. Please share with all if this solves your issues about find and replace, and quick search project wide.

    Maybe Eggplant can integrate with TextMate since TM has a nice communication and dependancy/change model it employs.
  • I was trying to see the scripts but when I tried to open it from eggPlant I cannot see the code (script is blank) but using notepad I see the following:

    {\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
    {\fonttbl\f0\fnil\fcharset77 HelveticaNeue;\f1\fnil\
    HelveticaNeue-Bold;}

    I tried opening them in WordPad first and use Save As... to save them as plain text but it is not working.

    Can you save them as plain text and load the files again?

    Thanks,
    Lucero
  • EggplantMattEggplantMatt admin ForumAdmin admin
    Just so you know, version 10.3 of eggPlant for Windows (available for download now) provides a mechanism for searching across all of the scripts in a suite. There is a search field above the list of scripts in the Scripts tab. This negates the need for the scripts provided here, at least on the Windows platform. This functionality should be available on the other platforms in their next releases.
  • I wanted to use this script to search and replace some image names.
    The new version 10.3 just searches but I cannot replace a word in all scripts.
  • EggplantMattEggplantMatt admin ForumAdmin admin
    I've uploaded a new version of the suite that has the scripts saved as plain text.
Sign In or Register to comment.