Jump to content

2014 script will not run in 2015


Recommended Posts

I have a complicated dialog script I wrote years ago that has been running fine in 2012-2014, but does not work in 2015.

This script has 2100 lines of code and the dialog has two Tab Panes, and each tab pane has various radio buttons and checkboxes and has various images that display depending on the choices made.

It was built using Dialog Builder 4 and had many deprecated handler routines, so I replaced them all with the new Layout Manager APIs. I did this in 2014 until I got it compiling and producing no errors when running in Developer Mode.

This modified script runs fine in VW 2014 and the dialog displays correctly.

In VW 2015, this script compiles and has no errors while running in developer mode, yet when I use the tool, the only dialog that come up is the default empty dialog with only O.K. and cancel buttons.

Can anyone explain what is going on here?

Link to comment

I now believe the problem is with the Image Resources in my dialog. The image is the First Layout Item in my dialog setup, so it does not get past this.

I have read the Developer Page on the new .vwr image resource format, but I am not understanding it completely.

On a Mac, how do I make a .vwr folder. Is this just a Mac folder with the .vwr extension, or is this some special file type? Is the name of the .vwr folder the name of the Plug-in?

Inside this file/folder do I have a sub- folder called 'Images', and then put my Images In there? What Image type is required, are .png files O.K.?

Can anyone explain this a bit more clearly?

Link to comment
  • Vectorworks, Inc Employee

A .vwr file is actually an uncompressed zip file.

You should be able to make a folder with a .vwr extension. (I know this works on Windows but on Mac you may have to zip the folder using the command line or another utility but it must NOT be compressed.)

.png files are just fine.

Using sub-folders asr optional.

When you create or update the image control you are going to specify the file using.

Resource file -> MyCustomResource.vwr

Image -> xyz.png


Vectorworks VWR Resource

Edited by klinzey
Link to comment

Thank you,

My dialog now shows the Image when it first comes up, but it disappears when I click on anything in the dialog. The folder seems to work without being Zipped (uncompressed).

So what do I use in the Handler Routine to set the Image choice? SetControlData takes a LONGINT variable, so I found "SetImageControlPath" in the Function Reference and tried it using:

IF boo9 then boo := SetImageControlPath(DialogID,ControlID,'MyCustomResource/xyz.png');

But it did not fix it. The image still disappears when I click on anything or if I choose the second dialog Tab.

And how do error check the Image availability in the main routine? I have:

rsAvailable:= SetVSResourceFile('MyCustomResource');

But I do not think "SetVSResourceFile" works anymore.

Link to comment

Resource files were totally re-worked for 2015. See Kevin's link to the developer wiki above. The page explains the correct format for resource files. If you scroll down to the bottom of the page, you can find information on the new vs routines.

Once you get the hang of it, managing resources actually becomes much easier.


Link to comment

The only one VectorScript routine I see at the bottom of the Wiki page is "GetVWRString". The 2015 Function Reference says this loads a "String" from a VWR file.

I am Loading "Images" not "Strings". Is this still the correct Procedure?

I have 97 Images in my dialog that display depending on the choices made.

I have now used "GetVWRString" to set all my Images. The good news is the image no longer disappears when I make choices in the dialog, the bad news is only Image 1 of 97 displays no matter which choice is made or which Tab is selected.

Here is what I am using to call the Images in the Handler Routine:

IF boo1 THEN GetVWRString(str2,'MyCustomResource/Images', 'Image1.png');

IF boo2 THEN GetVWRString(str2,'MyCustomResource/Images', 'Image2.png');

IF boo3 THEN GetVWRString(str2,'MyCustomResource/Images', 'Image3.png');


Is this the correct format?

What is the third variable, the "Key", or StringIdentifier? Is that the name of the Image File?

Link to comment

O.K. Thank you very much for that. I searched through the Function Reference for such a command, but I guess I missed that. I wish the Function Reference had a search function.

I sure do not see UpdateImageControl2 or CreateImageControl2 mentioned in the Developer Wiki Page, or did I miss that too?.

Is there somewhere I can find a list of ALL the new functions necessary for Image control in a Dialog for VectorScript? I am also curious why the Resource Functions that do not work in 2015 are not shown as obsolete or deprecated in the Function reference.

I also searched the VS List Archives for anything on Image Resource Control and struck out.

Or is it because of the SDK and Python that VectorScript is just not being used by anyone anymore?

Sorry if I sound frustrated, But I am an architect and I am supposed to be working on projects, but I have spent the last four days trying to fix a script that has been running flawlessly for many years.

Thanks again for the help.

Link to comment
  • Vectorworks, Inc Employee

All the obsolete functions and replacements are listed here:

Version Information

CreateImageControl() and other functions may not be completely deprecated but are just deprecated in the instance you are trying to use them. We can mark a call if it is completely deprecated but if it is still used under certain conditions it remains functional.

VectorScript is still a valid language and the Python interface to Vectorworks is based on the Vectorscript functions.

Much of the changes in the resource handling is due to Apple's deprecation of QuickTime.

Link to comment

The function reference in the developer wiki is more comprehensive than that in the help. You can both search the page for a function name, and there is a site search function.


The new image controls have actually been around for a while -- since VW 2012. What has changed is the resource file format, as well as the SetVSResourceFile command. Setting the image isn't deprecated per se, but the command that loads a resource file into memory is. The one thing that has changed completely is string functions.

Because of the resource file update, this switch happened fairly abruptly. Usually, deprecated functions will simply generate warnings for a few versions before they disappear completely.



Link to comment

O.K., So I guess even if you are using CreateControl which says is deprecated since 2012, it will not generate a VS warning in VW 2013 or VW 2014.

Since I was using it for Image Resources I guess I figured it would have generated an error, but it does not.

I always run VW in Developer Mode as I want to know if any of my scripts are generating errors. I guess I cannot completely rely on that anymore.

As for SetControlData, It must still be used for something in 2015, as it is not marked as deprecated.

And for SetVSResourceFile, the Vectorworks VWR Resources page says:

Old functions

VS:SetVSResourceFile -- not doing anything in Vectorworks 2015

If it really does nothing, shouldn't that be marked as obsolete in 2015?

Also, I find it hard to believe that a Developer page devoted to "VWR in Vectorworks 2015" does not even mention the Procedures "CreateImageControl2" or "UpdateControlData2", even if they were introduced in 2012, since they did not stop working until 2015. That would have saved me several days of work. I was still using "CreateControl" and SetControlData" in 2014 and they worked fine. Thanks Joshua and Kevin for pointing me in the right direction.

I will dig a bit deeper in the Developer Wiki the next time I have a problem.

Bottom Line: My script is running again.

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.

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