program ScriptRenameZL; uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, TypInfo, ToolsAPI,CnCommon, CnWizUtils,CnWizIdeUtils,IdeInstComp; //IdeInstComp CnWizIdeUtils CnWizUtils { Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, TypInfo, ToolsAPI,CnCommon, CnWizUtils,CnWizIdeUtils;} var //DesignContainer, Comp: TComponent; DesignContainer:TCustomForm; comp:TWinControl; I,CompCount: Integer; begin //for I := 0 to Screen.FormCount - 1 do { var Menu: TMenuItem; MainForm: TCustomForm; Component: TComponent; begin MainForm := GetIdeMainForm; if MainForm <> nil then begin Component := MainForm.FindComponent(‘HelpMenu‘); if Component = nil then begin ErrorDlg(‘Help Menu NOT Found.‘); Exit; end; } DesignContainer := IdeGetDesignedForm(form1); //xe10.1 下不能用,之前在xe7下可以用 //DesignContainer := GetIdeMainForm; //DesignContainer := Screen.Forms[0]; if DesignContainer = nil then begin showmessage(‘NO form xxx Found.‘); Exit; end; CompCount:= DesignContainer.ComponentCount; showmessage(inttostr(compcount)); for i := 0 to CompCount - 1 do begin //showmessage(DesignContainer.Components[i].classname); if DesignContainer.Components[i].classname=‘TEdit‘ then begin showmessage(‘a‘); GetHzPyW(GetStrProp(DesignContainer.Components[i],‘caption‘)) Comp :=TEdit(DesignContainer.Components[i]); SetPropValue(Comp, ‘Name‘,‘edtzl‘+ inttostr(i)); end; end; end.