VS:ImportResToCurFileN
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Imports the indicated resource from the specified list to the current file, if it is not already in the current file, and returns the handle to the resource.
This function is similar to VS:ImportResourceToCurrentFile but it will not show a dialog when there is a conflict during the import.
FUNCTION ImportResToCurFileN(
listID : LONGINT;
index : LONGINT;
callback : FUNCTION) : HANDLE;;
def vs.ImportResToCurFileN(listID, index, callback): return HANDLE
Parameters
type INTEGER the type of resource to put in the list listID LONGINT an ID for a resource list created by the VS:BuildResourceList or VS:BuildResourceListN command index LONGINT an index into the list. callback FUNCTION a callback function used to resolve conflicts silently.
Remarks
The call back function will be called for a resource that cannot be imported due to a name conflict. The callback function should have the following definition:
FUNCTION ImportResourceCallback(VAR resourceName:DYNARRAY OF CHAR) : INTEGER;
The 'resourceName' parameter contains the name of the conflict resource. The user might change the value in order to rename the imported resource. The return value will tell Vectorworks how to resolve the conflict. The following values are defined:
- 0 - Do Not Import -- the conflict resource will be skipped during import.
- 1 - Replace -- the conflict resource will replace the existing in the document.
- 2 - Rename -- the conflict resource will be imported under the new 'resourceName' parameter value. If there is still conflict the callback function will be called again with the new name.
Example
{ try this on a file with some symbol folders } PROCEDURE testResCountSymFolders; VAR resList : LONGINT; numRes : INTEGER; h : HANDLE; FUNCTION ImportResCallback(VAR resourceName:DYNARRAY OF CHAR) : INTEGER; BEGIN AlrtDialog( resourceName ); resourceName := Concat( resourceName , '-1' ); ImportResCallback := 2; END; BEGIN { list symbol folders in curr doc } resList := BuildResourceList(16, 23, '', numRes ); h := ImportResToCurFileN( resList , 1, ImportResCallback ); alrtDialog(concat('numRes=', numRes , ' h=', h)); END; RUN(testResCountSymFolders);
Version
Availability: from Vectorworks 2012
See Also
VS Functions:
VS:ImportResourceToCurrentFile | VS:BuildResourceList |VS:BuildResourceListN