Jump to content
Developer Wiki and Function Reference Links ×

How to filter out PIO records


Sam Jones

Recommended Posts

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.

Link to comment

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

Link to comment
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 by Sam Jones
parameter corection.
Link to comment

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);

 

  • Like 1
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...