Thanks! Just what I needed.
I extended that code to fully initialize the replace.
It sets the find and replace strings, sets Perl RE and LookIn=CurrentBuffer.
I've attached the full code to the translator.
Select a block of text with the Find/Replace terms - one pair on each line.
Run translateTerms.
It will open a find/replace dialog with the search strings initialized to do all the replacements.
Example:
%windir%=C:\WINDOWS
%ProgramData%=C:\ProgramData
This will replace "C:\Windows" with "%windir%" and "C:\ProgramData" with "%ProgramData%"
int gui_replace_init_re(_str findstr="", _str replacestr="")
{
int formid;
if (isEclipsePlugin()) {
show('-xy _tbfind_form');
formid = _find_object('_tbfind_form._findstring');
if (formid) {
formid._set_focus();
}
} else {
tool_gui_replace();
formid = activate_tool_window('_tbfind_form', true, '_findstring');
}
if (!formid) {
return 0;
}
_control _findstring;
_control _replacestring;
_control _findre;
_control _findre_type;
_control _findbuffer;
formid._findstring.p_text = findstr;
formid._findstring._set_sel(1,length(findstr)+1);
formid._replacestring.p_text = replacestr;
formid._findre.p_value=1;
formid._findre.call_event(formid._findre,LBUTTON_UP);
formid._findbuffer.p_text = SEARCH_IN_CURRENT_BUFFER;
formid._findre_type.p_text = RE_TYPE_PERL_STRING;
formid._findre_type.call_event(formid._findre_type,LBUTTON_UP);
return 1;
}