cheesetoast8 Posted April 6, 2018 Posted April 6, 2018 I need a script like the one that lets you add prefixes & etc to editorIDs, but it needs to be added to the FULL - NAME entry instead.
payl0ad Posted July 23, 2018 Posted July 23, 2018 Use this:{ This script will prepend or append supplied value to the Name field of every selected record. } unit UserScript; var DoPrepend: boolean; s: string; function Initialize: integer; var i: integer; begin Result := 0; // ask for prefix or suffix mode i := MessageDlg('Prepend [YES] or append [NO] to Item Name?', mtConfirmation, [mbYes, mbNo, mbCancel], 0); if i = mrYes then DoPrepend := true else if i = mrNo then DoPrepend := false else begin Result := 1; Exit; end; // ask for string if not InputQuery('Enter', 'Prefix/suffix', s) then begin Result := 2; Exit; end; // empty string - do nothing if s = '' then Result := 3; end; function Process(e: IInterface): integer; var elEditorID: IInterface; begin Result := 0; //AddMessage('Processing: ' + Name(e)); elEditorID := ElementByName(e, 'FULL - Name'); if Assigned(elEditorID) then begin if DoPrepend then SetEditValue(elEditorID, s + GetEditValue(elEditorID)) else SetEditValue(elEditorID, GetEditValue(elEditorID) + s); end; end; end.
Recommended Posts