Jump to content
Sign in to follow this  
Bill

$include error: "Could not open INCLUDE file"

Recommended Posts

I'm experimenting with VectorScript includes.

This is the main chunk of code:

code:

Procedure TestIncludes;

Begin

{$include d:\TestInclude.vss}

End;

Run (TestIncludes);
[/code]

And this is the contents of d:\TestInclude.vss:

code:

SelectAll;[/code][/indent]

When I run it, I get this error:

  • Line #5: {$include d:\TestInclude.vss}

    { Error: Could not open INCLUDE file. }

If I replace the include with "SelectAll;" it works fine.

I can copy the file name from the "$include" and paste it after the windows "dir" command and it works fine.

Any idea why it can't open the file?

Share this post


Link to post

Bill,

You should be able to specify any file name that you have access to when the script is run. I have even included files across a Mac/PC network during debug, so I know it will work.

Before checking the spelling of your file name, put a blank between the .vss and the "}".

{$include d:\TestInclude.vss }

I am not sure if this is necessary, but I remember trying it once.

Then, if that doesn't work, put a blank character after

SelectAll;

or put a blank line after

SelectAll;

in your included file.

I think one of these suggestions will work (probably the last one). Let us know what you find.

Raymond

Share this post


Link to post
Guest

For script-palette scripts, an include path begins at the folder that contains the application.

For a plug-in script, an include path begins at the Plug-ins folder.

Jeff

Share this post


Link to post

Hi Jeff,

Page C-1 of VS Language Guide,"C:\Program Files\VectorWorks 11.5.0\VWHelp\Additional Documentation\VSLanguageGuide_11_5.pdf"

Show this as an example of the synatx of $include:

code:

{$INCLUDE MyHD\VectorWorks\Projects\VS\mycode\math.vss}[/code][/indent]

I.e. it implies that this is valid:

code:

{$include d:\TestInclude.vss}[/code][/indent]

Question

Is the Language Guide wrong?

Question

When you said:

quote:

an include path begins at the folder that contains the application.


is the application MY application and the folder is the folder that contains my xyz.mcd file?

Share this post


Link to post

This has a semi-happy ending ...

Thanks for the ideas, however nothing worked, but as you will soon see, they did lead to something else to try. Before I get to that, I wrote a little script to see if I could read the file, instead of $include it, and that did work.

As a variation on Alexandre's idea I put the file in C:\Program Files\VectorWorks 11.5.0, instead of in C:\Program Files\VectorWorks 11.5.0\Plug-Ins. I.e. I put the file in the folder/directory where the VectorWorks executable is.

And guess what, this worked: {$INCLUDE TestInclude.vss}

So it seems there is a bug in $include that is preventing it from handling fully qualified file names.

[ 04-27-2005, 12:37 PM: Message edited by: Fozz ]

Share this post


Link to post

Raymond,

I'm sort of glad you are having the same problem on the Mac, at least I'm not crazy.

I experimented with your hint about the shortcuts (links, aliases).

I was able to put a shortcut, in the VW program folder (c:\Program Files\VectorWorks 11.5.0), to my script on another disk. This is the file name of the sortcut created by windoze:

code:

IncludeErrorFromLnk.vss.lnk[/code][/indent]

This include worked:

code:

{$INCLUDE IncludeErrorFromLnk.vss}[/code][/indent]

I also put a shortcut, in the VW program folder, to another folder, not just a file. That folder was also on another disk. This is its folder name:

code:

IncludeError.lnk[/code][/indent]

I was then able to include scripts from the folder:

code:

{$INCLUDE IncludeError\IncludeError.vss}[/code][/indent]

I submitted a bug report on 4/29 to vs_support@nemetschek.net. No response yet.

Thanks for the tip.

Share this post


Link to post

Hi Bill,

I just loaded VW 11.5 on my Mac and noticed there is a difference between it and VW 10.5. Where I could open any file on any hard drive with the $INCLUDE statement in v10.5, I cannot in v11.5.

Since I am developing PlugIns for 2 platforms and have many files to include, I have opted to have a single directory for development outside the application folder, rather than work out of the Plug-Ins folder. In v10.5, VW on both platforms can link these files onto a PIO with a single $INCLUDE and all subsequent $INCLUDE files can be called from the main file. Perhaps it can be done in v11, but I haven't figured out how.

SO?, I did the next best thing I could think of. I put an Alias/Shortcut for the hard drive into the Plug-Ins folder. I haven't tried in on the Windows side yet, since I only have v10.5 on the PC, but it works nicely on the Mac. This seems to be an acceptable work around for me. Give it a try and tell me if it works for you.

Raymond

Share this post


Link to post

Bill,

I'm glad you are up and running. Responses take a while, but they do come.

If you put a shortcut to the C:\ directory, or any root volume, in your VW folder, you will then be able to $INCLUDE any file by using the complete pathname to that file. In this way, you will only need 1 shortcut per Disk Volume, instead of 1 shortcut for each project directory you are using, which will keep your VW directory much less cluttered over time.

Raymond

Share this post


Link to post

Bill,

What happens if you put the D:\ shortcut in the Plug-Ins folder instead of the application folder? Will {$INCLUDE D:\wff\vw\Scripts\EraseBanana.vss} then work?

Raymond

Share this post


Link to post

Raymond,

Test 1: using "D:"

If you literally meant to use "D:\..." I don't know how to get that to work, i.e. use a ":". Since this worked: {$INCLUDE d\wff\vw\Scripts\EraseBanana.vss}, I thought that I just needed to copy "d.lnk" to "d:.lnk". But, that put the file named ".lnk" on my d-drive. Trying to rename it resulted in a DOS syntax error. (I'm playing around in a command prompt window).

With this shortcut file:

code:

C:\Program Files\VectorWorks 11.5.0\Plug-Ins\d.lnk[/code][/indent]

I got the error on this include:

code:

{$INCLUDE d\wff\vw\Scripts\EraseBanana.vss}[/code][/indent]

I copied d.lnk up to the VW folder and it worked.

Test 2: Using the Plug-ins folder

To make things a little simpler I put a script with this name in the Plug-Ins folder: FakePlugin.vss. I.e. no short cuts involved.

This include gave that same error:

code:

{$INCLUDE FakePlugin.vss}[/code][/indent]

But, if I moved it up to the main VW folder the that same include worked.

If I moved the file back to Plug-Ins, this include did work because plug-ins is in the main VW folder:

code:

{$INCLUDE plug-ins\FakePlugin.vss}[/code][/indent]

Therefore
, I think that VectorScript includes have a bug and only allow you to include from the main Vectorworks folder.

If you want me to try anything else for you, let me know.

Share this post


Link to post

Ramond,

I tried the root volume shortcut idea. In windoze terminology I open "My Computer" and opened another window and navigated to the VW folder. Then I dragged by d-drive as a short cut to the VW folder.

I first tried this as the include but it gave me my original error:

code:

{$INCLUDE D:\wff\vw\Scripts\EraseBanana.vss}[/code][/indent]

Then I decided to look at the file name of the actual link. This is the file that it created in the VW folder:

code:

Data Disk 1 (D).lnk[/code][/indent]

And this wierd looking VectorScript include worked:

code:

{$INCLUDE Data Disk 1 (D)\wff\vw\Scripts\EraseBanana.vss}[/code][/indent]

I then renamed the long d-drive lnk file to:

code:

d.lnk[/code][/indent]

And this include worked:

code:

{$INCLUDE d\wff\vw\Scripts\EraseBanana.vss}[/code][/indent]

Thanks for the interesting tip.

Share this post


Link to post

Hi Bill,

Thanks for the tests. Bug or not, the $INCLUDE functionality changed from v10 to v11. Yes, as far as I can tell, included files can only be resolved in v11 if they reside inside the VW application folder. Using shortcuts/aliases can get you outside that realm. Personally, I'd like to see it work they way it used to in v10, but I can live with using aliases for my hard drives in the VW App folder.

All the best,

Raymond

Share this post


Link to post
Hi Bill,

Thanks for the tests. Bug or not, the $INCLUDE functionality changed from v10 to v11. Yes, as far as I can tell, included files can only be resolved in v11 if they reside inside the VW application folder. Using shortcuts/aliases can get you outside that realm. Personally, I'd like to see it work they way it used to in v10, but I can live with using aliases for my hard drives in the VW App folder.

All the best,

Raymond

So how exactly are palette scripts linked to other files ?

I manage to use the includes on my custom PIO's but can't get it to work on my palette scripts, the above posts ain't clear for me either :)

using vectorworks 2010:

Palette script includes $INCLUDE scripts\filename.vss

scripts is a folder on the network, which has a shortcut in my main vectorworks installation folder.

My code is getting cut because its too big, so I need to get this to work

Edited by hippothamus

Share this post


Link to post

In general, the starting path for an include is the file from which it is run. For Plug-Ins, this is the plug-ins folder, and for files, it is the document.

Alternatively, you can include full paths--

Macintosh HD:Users:Username:VS Includes:file.px|vss

Macintosh HD/Users/Username/VS includes/file.px

c:\Users\Username\Documents\VS includes\file.px

That allows you to have the include file anywhere, which can be very useful.

-Josh

Share this post


Link to post
In general, the starting path for an include is the file from which it is run.

This is the reason why you need to decide some sort of folder structure at the beginning and where you will put your .vso .vsm and .vst files, because these will determine the start of where VS will look for the includes.

Personally, I did put the plugin files into the main plugin folder and having all .px files in some sort of folder structure. Then all includes can be the same as long as the folder structure stays the same. Your library files can be easily done.

Recently, due to the fact of too many plugin files, I now have one folder for each plugin into the main plugin folder. The plugin files are each in their folder, just one folder down from the main plugin folder. The rest stays the same. I only need to add .. before the include path everywhere if I need to include a file that's not part of the actual plugin, like library files. This is also very easy.

long story short: decide your structure and then stick with it to easily create the include paths. I really won't recommend using full paths from your hard drive, because when you move your main plugin folder due to restructuring some data folders, or because you copy your library for a new VW version, you'll have to edit all include paths, which can be a lot of work.

Share this post


Link to post
In general, the starting path for an include is the file from which it is run. For Plug-Ins, this is the plug-ins folder, and for files, it is the document.

Alternatively, you can include full paths--

Macintosh HD:Users:Username:VS Includes:file.px|vss

Macintosh HD/Users/Username/VS includes/file.px

c:\Users\Username\Documents\VS includes\file.px

That allows you to have the include file anywhere, which can be very useful.

-Josh

I've got a shortcut "scripts" in my vectorworks application folder that points to our network drive. My palette scripts use included files from scripts/filename.vss.

I can only manage to do so with a shortcut, I can't open scripts directly from my vectorworks folders or anywhere else ? An error that files can't be opened, yet they have all permissions and can be found. ( The error is not the same as "file not found".)

btw, it seems that sharing custom PIO's is also possible, with a shortcut to each PIO. Shortcuts have to be placed in the application plugin-folder and must have exact the same name as the PIO. This is how I share all our tools with colleges, without them having to update on each change :)

Edited by hippothamus

Share this post


Link to post
I really won't recommend using full paths from your hard drive, because when you move your main plugin folder due to restructuring some data folders, or because you copy your library for a new VW version, you'll have to edit all include paths, which can be a lot of work.

I made a slight misstep in my earlier post -

At least on the Mac, you can also use a UNIX style path -- so your include can be at:

/Users/username/my scripts/include.px

That way you can have one copy of the code for several versions of VW, and avoid library issues altogether.

-Josh

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...