I think it might be a problem with this line.
$htm2pdf=(pluginmsg(toolbars,"AddButton","htm2pdf,htm2pdf,macros("."htm2pdf"."),"." . ".",".$htm2pdf_Tooltip.",16,16,"."htm2pdf.bmp[1],htm2pdf.bmp[0]",""));
This is some code I just did for a button.
## create toolbar
$_PClear_ToolbarName = "P_Clear" ;
$_PClear_BSize = "16" ;
$_PClear_LastItem = "" ;
$_PClear_AddBarTag = $_PClear_ToolbarName .",". $_PClear_BSize .",". $_PClear_BSize .",". $_PClear_LastItem ;
pluginmsg(toolbars, "AddToolbar", $_PClear_AddBarTag);
## create button
$_PClear_ButtonName = "FlipJS" ;
$_PClear_Command = "macros(_P_Clear_Destroy)" ;
$_PClear_MenuName = "P_Clear List" ;
$_PClear_tipText = "Clear all privacy items \nRight click for menu";
$_PClear_ImageHot = "P_Clear.bmp" ;
$_PClear_ImageCold = "P_Clear.bmp" ;
$_PClear_ImageDead = "P_Clear.bmp" ;
$_PClear_AddButtonTag = $_PClear_ToolbarName.",".$_PClear_ButtonName.",".$_PClear_Command.",".$_PClear_MenuName.",".$_PClear_tipText.",".$_PClear_BSize.",".$_PClear_BSize.",".$_PClear_ImageHot.",".$_PClear_ImageCold.",".$_PClear_ImageDead.",".$_PClear_LastItem ;
pluginmsg(toolbars, "AddButton", $_PClear_AddButtonTag);
}
Your code seem to set the pluginmsg(toolbars, "AddButton" ... to a variable. In my code I just run that line.
Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.â€
JamesD