Sam Jones Posted April 2, 2021 Share Posted April 2, 2021 It is possible to import resources from a file into the current file. There are a variety of ways to do this with BuildResourcList() and ImportResourceToCurrentFile() and CopySymbol(). All of these require that the script maker know the file name or folder name containing the resource. Is it possible to present the user with a Finder brower or Director trouser similar to the one presented with the PutFile() command? I would like to present the user with a way to find a file or folder from which to import resources. Possible ?? Quote Link to comment
JBenghiat Posted April 2, 2021 Share Posted April 2, 2021 See https://developer.vectorworks.net/index.php/VS:BuildResourceListN and https://developer.vectorworks.net/index.php/VS:BuildResourceListN2 Quote Link to comment
Sam Jones Posted April 2, 2021 Author Share Posted April 2, 2021 I don't see how these help. They don't let the user look around their hard disk for the file they want to get resources from. With "PutFile", the user can look around their hard disk for the text file they desire. Perhaps, you have nifty little algorithm that simulates this functionality for finding .vwx files????? Quote Link to comment
JBenghiat Posted April 2, 2021 Share Posted April 2, 2021 You almost answered your own question. https://developer.vectorworks.net/index.php/VS:GetFileN Quote Link to comment
Sam Jones Posted April 2, 2021 Author Share Posted April 2, 2021 Unfortunately, I cannot get that to work. This code from the developer wiki fails to allow the selection of a .vwx file. PROCEDURE Example; VAR fileName, title :STRING; defaultFolder :STRING; mask :STRING; BEGIN title := 'Select the object library file...'; defaultFolder := ''; mask := '*.vwx'; fileName := 'Drafting Tools.vwx'; IF GetFileN(title, defaultFolder, mask, fileName) THEN AlrtDialog(fileName); END; RUN(Example); Quote Link to comment
Jesse Cogswell Posted April 3, 2021 Share Posted April 3, 2021 Unfortunately, I don't think Vectorscript has any commands dealing with files outside of text files for logs or resources. I think you might need to use Python's ability to deal with files using PythonBeginContext and PythonExecute to pull Python coding into Vectorscripts. As a disclaimer, I have not yet tried this, but I suspect it's very possible. 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.