PROGRAM FontSizes; {-- *************************************************************************** -- ** Descr. : A simple tutorial script looping through boilerplate text items -- ** and change the fontsize. -- ** -- ** MINVERS: runs on all versions -- *************************************************************************** -- ** 04/01/02 1.001.00 Initial Creation, muellers@orcl-toolbox.com -- ***************************************************************************} {*Global Variable Declaration*} VAR v_filename : varchar2; i,j : number; fntsize : number; frm : number; files : TStringList; items : TStringList; item : number; ps : TParamScreen; pb : TParamBoard; {*Main Program Block*} BEGIN //build together a nice parameter screen ... ps := TParamScreen.create; pb := ps.AddBoard('Modules',picModules); pb.addparam(parLabel,'MYLABEL','Changes fontsize of boilerplate texts.','',''); pb.addparam(parFiles,'FILES','Source Files','','Forms Modules (*.fmb)|*.fmb|All Files (*.*)|*.*'); pb.addparam(parPathname,'TRGPATH','Target Path','',''); pb.addparam(parInteger,'FONTSIZE','New Font Size','14',''); //show the parameter screen and wait for inputs if ps.ShowParamScreen('Boilerplate Font Sizes ...') then begin //get the selected files into a list files := tstringlist.create; files.text := ps.paramvalue('FILES'); //calculate the new fontsize - the size is internally always multiplied by 100! fntsize := to_number(ps.paramvalue('FONTSIZE')) * 100; if ps.paramvalue('TRGPATH') = '' then raiseException('Target path must be specified!'); //loop through all the files for j := 0 to files.count-1 do begin v_filename := files.strings[j]; logadd('Checking ('+to_char(j+1)+'/'+to_char(files.count)+' '+v_filename); try // load the forms module frm := API_LoadModule(files.strings[j]); //get all objects of the forms into a list items := api_getallobjects(frm); //loop through the list of items for i := 0 to items.count-1 do begin item := items.objects[i]; //is item a graphic item or not ? if generic_querytype(item) = D2FFO_GRAPHIC then begin //is the graphic item of type text ? if generic_getvalue(item,D2FP_GRAPHICS_TYP) = D2FC_GRTY_TEXT then begin //we found a match, so set the new fontsize! generic_SetValue(item,D2FP_GRA_FONT_SIZ, fntsize); end; end; end; //free the list of items from memory items.free; //now modify the filename to point to the new location v_filename := ps.ParamValue('TRGPATH') + '\' + ExtractFileName(v_filename); //and save it to the new location API_SaveModule(frm,v_filename); //... and finally release the module from memory API_DestroyModule(frm); except // ups! an error happened, so just log it and proceed to the next module logadd(' =>'+GetError,LogError); end; end; //free the file list from memory; files.free; end else begin //user must have pressed cancel on parameterscreen logadd('Canceled on parameterscreen!'); end; // free the parameter screen ps.free; END.