+ Start a Discussion
RichardC.ax220RichardC.ax220 

Tool for mass editing S-Controls?

I am converting an app to a managed package, which means I need to add a registered prefix to each object and field reference in about 12 S-Controls. In some cases, I also want to change other parts of a field name as well. I have enough object and field references in the S-Controls to justify using a tool to make these changes. Does anyone know a tool that can mass edit all of my S-Controls, given an array of "match string" and "replace string" pairs?
Ron HessRon Hess
Eclipse has search and replace, just open the project, search for the old name and enter a replace string.
it's not fully automated, but can be pretty fast task.

If you are not using Eclipse, it's worth the time to setup.
RichardC.ax220RichardC.ax220
Ron - thanks for the reply. I use Eclipse to develop S-Controls and like its powerful search and replace feature. In this case,  I'm concerned that I'd miss one or more of the 60 field renames and 12 object renames over 10 S-Controls. I would rather develop code that does the mass changes, base on a rough estimate of the time involved. But if someone already has developed a way to mass edit S-Controls, I'd be glad to test it for them. :)
mikefmikef
In Eclipse you can use a regular expression to search. Just look for anything that ends with '__c' and you will find every custom field, and object.

There are also Eclipse plugins for writing and testing regular expressions before you use them.
ShinShin
How about using JavaScript shell in AJAX Tools ? I've write following script to replace objectNames/fieldNames to namespace-prefixed one :

Code:
var ns = 'mynamespace';
sforce.connection.update(
  sforce.connection.query("SELECT Id,HtmlWrapper FROM Scontrol")
    .getArray('records')
    .map(function(r){ 
      r.HtmlWrapper = r.HtmlWrapper.replace(/([\w]+)__([cr])/g, ns+'__$1__$2');
      return r;
    })
)
Please note that this script automatically rewrite codes without any caution, so it may leads some code destruction. I'll recommend to backup scontrols in advance.