Thomas W Posted August 25, 2023 Share Posted August 25, 2023 Hi all, I'm writing a script and before cleaning it I reached the character limit that Vector's script editor accepts, so I'm testing the include files (even if after cleaning the script will be shorter (this is a method I wanted to test). I looked at the examples that are here : https://developer.vectorworks.net/index.php/VS:Include_Files_and_Encryption#See_Also And I have a few questions: 1- The unencrypted include files will be in .vss format and the encrypted ones will be in .px format, right? 2- Is it adding a .px extension to the include file that will encrypt the include file and the script? (extract : "Alternatively, include files can be encrypted along with the script which calls them by appending a .px extension to the name of the include file.") On the https page above it has the example below: in the include file myinclude.vss : PROCEDURE Remote_Sub; VAR j:INTEGER; BEGIN AlrtDialog('This is the include function'); END; and the calling script : PROCEDURE EncryptExample1; VAR i:INTEGER; s:STRING; {$INCLUDE myinclude.vss} BEGIN Remote_Sub; END; RUN(EncryptExample1); 3- I got it to work by specifying the exact path of type Y:\Thomas\VectorScript\TW VS Include script files with INCLUDE\myinclude.vss Is it possible to make it work without specifying the exact path as in the example? Or is it always an absolute or relative path? I tried by copying myinclude.vss to the default path shown in Script Options in the Script Editor: C:\Users\t.wanner\AppData\Roaming\Nemetschek\Vectorworks\2023\FRA\Plug-ins\Marionette but without success. If you have any advice on this, they would be welcome! Have a great day Quote Link to comment
Thomas W Posted August 25, 2023 Author Share Posted August 25, 2023 (edited) Ok sorry I found for question 3-: It's specified in the VectorScriptGuide.pdf : https://developer.vectorworks.net/images/7/72/VectorScriptGuide.pdf Example: Windows-style include directive {$INCLUDE MyHD\Vectorworks\Projects\VS\mycode\math.vss} Include files specified without any path information are assumed to reside in a predefined default path relative to the script. For document scripts and scripts run from text files, the default path is the location of the Vectorworks application. For plug-ins, the default path is assumed to be the folder where the associated plug-in is located. So putting the myinclude.vss file here; C:\Program Files\Vectorworks 2023 FR it works...with {$INCLUDE myinclude.vss} without specifying the exact path. Edited August 25, 2023 by Thomas W Quote Link to comment
Pat Stanford Posted August 25, 2023 Share Posted August 25, 2023 Adding the .px ALLOWS those files to be encrypted. But you still have to run the encryption process. Just adding the extension is not enough. And make sure you keep backup copies that are unencrypted as you can't go back once you do encrypt. Quote Link to comment
Thomas W Posted August 25, 2023 Author Share Posted August 25, 2023 Thanks for the clarification Pat, They did say "can be encrypted" but I preferred to ask. If you have a script that exceeds the script editor's character limit what would you recommend to still benefit from Vectorworks' script editor error finding? Quote Link to comment
Pat Stanford Posted August 25, 2023 Share Posted August 25, 2023 {$DEBUG} works with include files (both .vs and .px) as long as the file is not yet encrypted. On Mac I recommend BBEdit for external code as it does code keywords highlighting. I don't know of an equivalent for Win. 1 Quote Link to comment
Thomas W Posted August 25, 2023 Author Share Posted August 25, 2023 Merci, je vais déjà tester avec {$DEBUG} et les fichiers d'inclusions .vs Oui je suis sous Windows, pour mon information dans BBEdit vous pouvez inclure un fichier comme vs.py mais en Pascal? Quote Link to comment
Maarten DE Posted August 25, 2023 Share Posted August 25, 2023 On Windows you can use Notepad++. Fresh installed you can use the Pascal Syntax highlighting, that sure helps a lot for the readability. If you want VectorScript syntax highlighting and auto completion, you need to add a few files. Here's some more information but it seems all the download links are down... 😞 However, it seems my version can still be downloaded from Notepad++ itself: https://github.com/notepad-plus-plus/userDefinedLanguages/blob/master/UDLs/VectorScript_byMaarten.xml , I haven't checked if it still works though... 1 Quote Link to comment
Pat Stanford Posted August 27, 2023 Share Posted August 27, 2023 As Maarten says, Notepad++ (and BBEdit) both offer the ability to do language specific syntax highlighting. BBEdit has this built into the default shipping version, but when a new version of VW is released, you sometimes need to update BBEdit with the newest functions. 1 Quote Link to comment
Thomas W Posted August 28, 2023 Author Share Posted August 28, 2023 @Martin DE Thank you for this information! I downloaded your .xml version of the vectcorscript functions and copied it to C:\Program Files (x86)\Notepad++\autoCompletion and it works fine, it offers me the vectorscript functions that are available in your file. And the Pascal language defines for syntax highlighting also helps a lot. I was just wondering if there are new vectorscript functions do you update it yourself manually or point to an original Vector file that contains all the functions? @Martin DE and @Patrick Stanford In any case, thank you for all this useful information and have a nice day! Quote Link to comment
Maarten DE Posted August 28, 2023 Share Posted August 28, 2023 I rarely write VS nowadays, and if I do I use the build-in VS editor of VW which I think works pretty good for the things I need to do. So I'll not update that file anymore, but feel free to do so! BTW, I found the other file, it needs to be placed here: C:\Users\*yourUserName*\AppData\Roaming\notepad++ . This way you can use Vectorscript instead of Pascal. But be aware, this file is from 2014, so same as that other file, it's outdated, but feel free to add the new functions to it. userDefineLang.xml 1 Quote Link to comment
Pat Stanford Posted August 28, 2023 Share Posted August 28, 2023 This thread about adding newer functions to BBEdit MAY help you with adding them to Notepad. Good Luck. 1 Quote Link to comment
BillW Posted August 28, 2023 Share Posted August 28, 2023 Recently I moved to Notepad++ and have a full environment geared to Vectorscript but need to package and document. In the interim, find included an auto completion file for "Pascal" which is up to date for Vectorscript VW 2023. Place in the folder "notepad plus/autoCompletion" and set language to "Pascal". I also used the "Style Configurator" to add "User-defined keywords" to "Pascal" for Vectorscript specific "INSTRUCTION WORD"s. Find attached "stylers.xml" which replaces file in folder "Notepad plus". Rename the old one first if you want to keep for reference. Valid Vectorscript file extensions are ".vss" or ".px" Notepad implements plugins which add powerfull ways of improving the environment, particularly PythonScript plugin QuickText plugin NppSnippets plugin I wrote a python parser to get content from the Vectorscript Language Reference (HTML) which picked up procedure/function, parameters and description and was written to the autocomplete file. Needed a bit of prep work first though. In future, I will probably add new Vectorscript calls by hand. Note, if you type a bracket after a valid VS call, you get a popup message for the call. I have my own user defined language for Vectorscipt but I am having problems with the plugins and autocompletion not recognising the UDL so I use Pascal instead. Need to investigate further. I tend to install the portable version of Notepad++ so I can put on a memory stick. pascal.xml stylers.xml 1 1 Quote Link to comment
Thomas W Posted August 29, 2023 Author Share Posted August 29, 2023 Thank you for sharing @BillW! With these two files and the language set to Pascal it's a helper that works just fine,thanks! 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.