I am trying to write a script to use with HelpNDoc.
I am part way there:
var
aList: THndLibraryItemsInfoArray;
nCnt: Integer;
begin
// Get all items in the library
aList := HndLibraryItems.GetItemList([]);
// Go through each of them
for nCnt := 0 to Length(aList) - 1 do
begin
// Is this a image (1)?
// Is this a image map (9) ?
if(HndLibraryItems.GetItemKind(aList[nCnt].id) = 1 or HndLibraryItems.GetItemKind(aList[nCnt].id) = 9) then
// What is the default alternate text?
var aDefaultAltText := HndLibraryItemsMeta.GetItemMetaStringValue(aList[nCnt].id, 'defaultalttext', '');
// Update the alternate text if required
if(aDefaultAltText = '') then
// Now what do we do? We need to find all instances of where this library item has been used.
// When we encounter one that has an alternate text description we update the meta.
// How?
end;
// What is the default padding?
var aDefaultPadding := HndLibraryItemsMeta.GetItemMetaIntValue(aList[nCnt].id, 'defaultpadding', 0);
// Update padding if required
if(aDefaultPadding = 0) then
HndLibraryItemsMeta.SetItemMetaIntValue(aList[nCnt].id, 'defaultpadding', 5);
end;
end;
end.
I can:
- Iterate all library items
- Isolate all image / image map items
- Extract the default padding / alternate text values.
- Update the default padding value to 5 if it is 0.
The issue is with the alternate text. If it does not have a default value then I want to do this:
- Iterate all help topics
- Iterate all library items used in each help topic
- Find if the library item was used in that topic
- If it was, it gets alternate text value.
- If that value is not empty, apply it to the meta default value. Otherwise find the next instance.
If, by the end of iteration it did not find a alternate text value that was not empty it prints the library item name on screen.