Sam Jones Posted February 10, 2023 Share Posted February 10, 2023 It is possible to create a list of records in a document using the BuildResourceList( 47, 0, SubFolder, NumResources ) which will produce a resource list of record definitions. Some Questions: Is it possible to filter this list build to not include PIOs? If not, is it possible to look at the resulting list and identify the record definition, obtained with GetObject(GetNameFromResourceList( ResListID, Index )), that is a plug-In, or identify it as not a plug-in? The goal here is to produce a list of records in a document that do not belong to plug-in objects, like the list in the Data Pane of the OIP. Quote Link to comment
Pat Stanford Posted February 10, 2023 Share Posted February 10, 2023 Untested, but you should be able to build the list of all Records then iterate through the list and get the name of the Record. If you then do a GetType(GetObject(GetNameFromResourceList)) then it should return 86 for PIOs and 47 or 48 for Record formats (not sure if it will get the definition (47) or the record (48). If you want the resource list but not the PIOs in it, you should be able to use DeleteResourceFromList to clean it up. If you are building your list from multiple files, be careful as GetNameFromResourceList will have the file name prepended. HTH Quote Link to comment
Sam Jones Posted February 11, 2023 Author Share Posted February 11, 2023 (edited) 1 hour ago, Pat Stanford said: then it should return 86 for PIOs and 47 or 48 for Record formats (not sure if it will get the definition (47) or the record (48). Nope. It would seem that PIOs are not a resource. I hope I'm wrong about that but ResListID := BuildResourceList( 47, 0, SubFolder, NumResources ); FOR Index := 1 TO NumResources DO BEGIN ResName := GetNameFromResourceList( ResListID, Index ); ResHdl := GetObject( ResName ); ResType := GetType(ResHdl); IF (ResType <> 86) THEN BEGIN failed. ResType always yielded "47" for the PIO name. (I used the extra variables and lines for debugging purposes). Edited February 11, 2023 by Sam Jones parameter corection. Quote Link to comment
Pat Stanford Posted February 11, 2023 Share Posted February 11, 2023 One of the things I learned today: There is VS Function named IsPluginFormat that does exactly what you want. HTH Procedure Test; VAR NumResources:Integer; ResListID:Longint; Index:Integer; ResName:String; ResHdl:Handle; ResType:Integer; Begin ResListID := BuildResourceList( 47, 0, '', NumResources ); FOR Index := 1 TO NumResources DO BEGIN ResName := GetNameFromResourceList( ResListID, Index ); ResHdl := GetObject( ResName ); ResType := GetType(ResHdl); IF IsPluginFormat(ResHdl) THEN AlrtDialog(Concat(' It is a Plugin!!: ',ResName,' ',Index,' ',NumResources,' ',GetType(ResHdl))) ELSE AlrtDialog(Concat(' It is NOT a Plugin!!: ',ResName,' ',Index,' ',NumResources,' ',GetType(ResHdl))); End; End; Run(Test); 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.