VS:GetNameFromResourceList

From Vectorworks Developer
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix


Description

Returns the name to display of the indicated item in the specified resource list. If the list has items with the same name from different files, the display name will have the filename added to it in parentheses.
FUNCTION GetNameFromResourceList(
listID  :LONGINT;
index  :LONGINT) : STRING;
def vs.GetNameFromResourceList(listID, index):
    return STRING

Parameters

listID LONGINT an ID for a resouce list created by the BuildResourceList function.
index LONGINT an index into the list.

Remarks

To get the actual name use GetActualNameFromResourceList.

Example

VectorScript

PROCEDURE Test; 
CONST
    ObjectType = 97; { Texture Definition } 
    FolderIndex = 100; { BuildResourceList Def for Texture Folder See Func. Ref } 
    SubFolderName = ''; { Nul subfolder get all folders and subfolders } 

VAR
    MyName : STRING; 
    MyList : LONGINT; 
    NumItems : LONGINT; 
	hatch : HANDLE;

BEGIN
    MyList := BuildResourceList(ObjectType, FolderIndex, '', NumItems); 
    MyName := GetNameFromResourceList(MyList, 1); { change this number to get the names of other textures } 
    Message( Date(2, 2), ': The Name is ', MyName, ' *** Total items in list: ', NumItems); 
	
	hatch := GetResourceFromList(MyList, 1);
	IF (hatch = NIL) THEN
	hatch := ImportResourceToCurrentFile(MyList, 1);
	
	DeleteResourceFromList(MyList, 1);
END; 
RUN(Test);

Python

def Test():
    ObjectType = 97; #{ Texture Definition } 
    FolderIndex = 100; #{ BuildResourceList Def for Texture Folder See Func. Ref } 
    SubFolderName = ''; #{ Nul subfolder get all folders and subfolders } 

    MyList, NumItems = vs.BuildResourceList(ObjectType, FolderIndex, ''); 
    MyName = vs.GetNameFromResourceList(MyList, 1); #{ change this number to get the names of other textures } 
    vs.Message( vs.Date(2, 2), ': The Name is ', MyName, ' *** Total items in list: ', NumItems)
	
    hatch = vs.GetResourceFromList(MyList, 1)
    if (hatch == None):
        hatch = vs.ImportResourceToCurrentFile(MyList, 1)
	
    vs.DeleteResourceFromList(MyList, 1)
	
Test()

Version

Availability: from VectorWorks12.0

See Also

VS Functions:

VS:GetActualNameFromResourceList

VS Functions: [[VS:GetActualNameFromResourceList]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox