Jump to content
Developer Wiki and Function Reference Links ×

Script Length and Encryption?


MaxStudio

Recommended Posts

Is that as easy as saving them with a .px extension from my text editor?

I'm also interested and best practices when it comes to the location of the include files.

Currently, I have a central folder on my computer where I store all my plugin scripts. Each plugin has its own subfolder. Once the plugin is encrypted does it still need access to the files in this folder or does it become one all encompassing plugin file?

I'll perform some tests in the days ahead.

Edited by MaxStudio
Link to comment
Is that as easy as saving them with a .px extension from my text editor?

I'm also interested and best practices when it comes to the location of the include files.

Currently, I have a central folder on my computer where I store all my plugin scripts. Each plugin has its own subfolder. Once the plugin is encrypted does it still need access to the files in this folder or does it become one all encompassing plugin file?

I'll perform some tests in the days ahead.

yes, changing the extension in it's name is all it takes.

When your includes are in the .px format, they will be included once you encrypt them, so the encrypted file doesn't need them anymore. If they are normal tekst files, it will need them, that's why it's better to use .px files.

Keep in mind that using includes, the path you have to use is the path from where the real plugin is stored. Also don't forget to end each file with an empty line or else you will get errors and finding this culprit is really hard!

Link to comment

so if the plugin is stored in the plugin folder my px files need to be stored there as well? (only until encrypted... then i can remove them?)

I know what you mean with the empty line. I've run into the problem many times where I didn't hit return after I pasted an IF THEN statement. I usually ended up being told that I'm missing an END; the fix is just going back to the include file and hitting return after the END; and it then compiles correctly.

Link to comment
Ok so i tried encrypting and I got a bunch of errors telling me all my parameters were not declared. Any idea what that is about? I know the script compiles and works correctly if I enter it through the Vectorscript Plugin editor.

Any more info?

Make sure you set your include statements in the correct order and that VS can find them, and that they are .px files.

Edited by DWorks
Link to comment

This is the .px that I select when encrypting

PROCEDURE plugin;
VAR

x, y, width, height:REAL;

result		: BOOLEAN;
objname		: STRING;
oh,rh,wh		: HANDLE;

BEGIN
{ retrieve custom object information }
result:= GetCustomObjectInfo(objname,oh,rh,wh);

{ if object information was successfully retrieved }
IF result THEN BEGIN
	{ retrieve parameters }

	width	:= PWIDTH;
	height	:= pHEIGHT;


{$INCLUDE Macintosh HD:Users:Library:Plugins:draw.px}

END;

END;

RUN(plugin);

Then the draw.px file has the following:

 Rect(x, y, width, height);

When I run the Encrypt on the first px file it tells me:

width := PWIDTH; (identifier not declared)

height := pHEIGHT; (identifier not declared)

I'm not sure what is going on. How do the variables interact with the parameters in the VS Plugin Editor? How does the script know what the default parameters are? I'm guessing that disconnect has something to do with it.

Link to comment

I'm sorry I'm confused and not having success. Do i need to set up the script in the vectorscript plugin editor with all my parameters before encrypting?

Normally without encrypting I do the following:

1. Create the script parameters in the VS Plugin Editor with the plugin name CreateRectangle.

2. Paste my script in the script area and compile.

3. Add it to my workspace.

4. It works.

This is the process i'm attempting to going through now:

1. Create the script parameters in the VS Plugin Editor with the plugin name CreateRectangle.

2. Encrypt the script by selecting the CreateRectangle.px file

3. Save the new CreateRectangle plugin file to the Plugins folder. Should this have an extension? It doesn't seem to save with one.

4. Then i shut down vectorworks and restart.

I don't understand how the newly created encrypted plugin connects to the parameters in the VS Plugin Editor. I must be doing something wrong or out of order.

also when you say to comment out the variable definitions is this what you mean?

PROCEDURE plugin;
VAR

x, y, width, height:REAL;

result		: BOOLEAN;
objname		: STRING;
oh,rh,wh		: HANDLE;

BEGIN
{ retrieve custom object information }
result:= GetCustomObjectInfo(objname,oh,rh,wh);

{ if object information was successfully retrieved }
IF result THEN BEGIN
	{ retrieve parameters }

{  width	:= PWIDTH;
   height	:= pHEIGHT;  }


{$INCLUDE Macintosh HD:Users:Library:Plugins:draw.px}

END;

END;

RUN(plugin);

I really appreciate your help. Thanks

Link to comment

Thats where I'm getting confused... do i create and define the parameters through the plugin editor before I encrypt the script? Lets say I do, do I copy anything into the "script" area?

i did some screen shots to help explain:

Image01: (the parameters defined)

hNnJvPY.png

Image02: (nothing pasted in script editor, should there be?)

kJZjiws.png

Image03: (this is the file name before encrypting)

gwzxGzr.png

Image04: (the file i choose to encrypt)

HpYMftX.png

Image05: (the encrypted file I save and the location, what extension should this file have, notice there is already a file in the folder named 'CreateRectangle.vso' because of the parameters I created in vectorworks, do i choose to overwrite that file or create a new one?)

5kRMGMx.png

What do you think?

Link to comment

ok i think i may have figured out an alternative way to encrypt the script.

1. I set up the parameters as in Image01.

2. In the script editor (Image02) I paste the code from CreateRectangle.px and compile the script.

3. If everything go well I close the Plugin Editor and test the plugin.

4. If it works, I open up the Plugin Editor a 2nd time and highlight my plugin 'CreateRectangle'

5. I click and hold the following button combination:

Caps Lock+Shift+Option+Command

and click the script button twice. It locks my script and I can no longer edit it.

6. I shutdown vectorworks.

7. I moved the 'draw.px' file to a new location (to test that the plugin no longer needed to access the file.)

8. I restart vectorworks and test my plugin. It's still working without the 'draw.px' file.

That seems to work. Does anyone know anything wrong with this process? Does it give me the same result as using the "Encrypt VectorScript" menu option?

Link to comment

Ok, you are missing the point here. You need to add an include statement in the script of the plugin in the plugin editor. Only then will VW be able to lookup the code that it needs to execute. Then you need the included files, but once encrypted, you don't need them anymore because VW will just insert them before encrypting. Be sure to copy the plugin file first before encrypting because you can't decrypt it.

One of the good reasons to work with include files is to work in other text editors than the plugin editor.

Edited by DWorks
Link to comment

yes I was definitely missing the point. I finally got it working using the process above. I'm pretty excited about this because in the past I had to place the include files on each computer I wanted to run the script on. Now I only have to copy the one plugin file.

Thanks again for your guidance. It is very much appreciated.

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...