Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

ScriptLinker run Problem


Recommended Posts

I have Mastercam X6 loaded on both a 64 bit Windows 7 PC and a 32 bit Windows XP PC. I have installed the 64 bit version of ScriptLinker on my Win7 machine and the 32 bit version on my XP machine and in both cases I get the following error when I attempt to run ScpiptLinker:

 

Unhandled exception has occurred in a component in your

application. If you click Continue, the application will ignore this error

and attempt to continue.

 

Could not load file or assembly

'file:///T:Mastercam_X6_Development\vb\1-AutoPt2Arc.DLL' or one of

its dependencies. Operation is not supported. [Exception from

HRESULT: 0x80131515]

 

I am getting the DLL file created but not the FT file.

Does anyone have any insight into why I am getting this error.

 

Thank You

Link to comment
Share on other sites

Hi Ken,

 

Ping me in the morning and I'll go ask Roger Martin. My guess is that you need to place all the files locally on your PC when you run script linker. You could then modify the FT file manually to include the correct server path. This is just a guess though, I'll find out for sure in the morning.

 

Say hi to the boys (and Nancy) for me.

 

Thanks,

Link to comment
Share on other sites

Ken,

 

ScriptLinker has not really changed in years.

 

I just downloaded the X6 (64-bit) version and used it to create a DLL/FT file set

using the supplied sample files (the 2 BMPS and the AskColor.VBS)

 

Exactly where in the process do you get this? ->

Unhandled exception has occurred in a component in your

application. If you click Continue, the application will ignore this error

and attempt to continue.

 

And this? ->

Could not load file or assembly

'file:///T:Mastercam_X6_Development\vb\1-AutoPt2Arc.DLL' or one of

its dependencies. Operation is not supported. [Exception from

HRESULT: 0x80131515]

 

Put everything on your local system and try again.

What happens?

 

Even if that all goes correctly, it is still possible that the FT does not end up in the \CHooks folder.

(as described in the Scriptlinker.PDF)

Link to comment
Share on other sites

Good Afternoon:

 

I have checked and rechecked my process to see if I can find a problem with the way I am using the ScriptLinker application and have always come up with the same results. If I use the X5 version of ScriptLinker through Mastercam X5 I can pick VB script and Bitmap files from a folder located on a network resource and the DLL files is created in that same folder located on the network resource and the FT file is cerated on my local C: drive (in the mcamx5/chook folder). Then when I open the toolbar customize window and select the VB Script category all of my VB scripts buttons show up and can be used to run our VB scripts from that network folder. When I use the X6 version of ScriptLinker through Mastercam X6 and select a VB script and Bitmap file located on the same network resource the ScriptLinker application generates the error message seen above(the two blocks of information I typed out above are in one error message). By the time the error occurs the DLL file has been created in the folder on the network resource but the FT file never gets created on my local drive. Now if I move all of my resource files (VB script and bitmap files) on to my local hard drive the ScriptLinker application work in the way it was designed to. It creates a DLL in my shared/mcamx6/vb folder and a FT file in my program files\mcamx6\chooks folder. The reason this process is a problem is for the process to work it would require all 28 of my workstations to have the VB script and bitmap files loaded on to the local hard drives instead of having those resource files housed in a central library. I have also attempted to create the DLL on my local drive and then move them to the network folder and then change the path in the FT file but this results in buttons that display the genetic Mastercam X and when selected generating an error message saying that the DLL can not be found. This application has served us well for the previous versions of Mastercam and so I am hoping that it can be fixed so it will work in X6.

 

Thank You

  • Like 1
Link to comment
Share on other sites

Ken,

 

On my Windows 7 (64-bit) system I am seeing a difference between X5 and X6 -

but neither works if the DLL referenced in the FT file is located other than on the local system.

 

In X5 I can see the TipString and the (2) Icons in System Customize -

and if I add its icon to a toolbar, nothing happens when I click on it.

 

In X6 I do not see the TipString or the (2) Icons in System Customize (just the generic 'X')

If I now add its icon to a toolbar, when I click on it...

I get an ".NET Library Error" dialog about: "Function not found in Assembly" <path\name of DLL here>

 

There are .NET security "issues" involved when running a .NET application from a "non-local" source - (aka. Network)

If you Google "Deploying .NET Applications to a Network Location" you'll find out about the Caspol.exe

*Using this tool to set the "trust" level on the network folder that contains my NETHook DLL did not improve the situation for me.

 

So...

What I am seeing is not ScriptLinker, but attempting to have the NETHook DLL "out there" non-local.

This difference (between X5 & X6) may probably be due to the different versions of the .NET Framework involved.

For ScriptLinker X6, that is the .NET Framework v4 and for X5 it was a previous version.

*The only difference in the ScriptLinker utility from X5 -> X6, is the fact that for X6 it was built using Visual Studio 2010 (and references the.NET v4)

and for X5 was build with Visual Studio 2008 (which utilized a previous version of the Framework).

*Mastercam X6 requires use of the v4 version of the Framework for NETHooks.

 

To test this -

I created a simple "Hello World" NETHook DLL/FT package for X6 (ScriptLinker was not involved).

I placed the DLL in a folder on my local machine and it works fine.

Then I placed that DLL out on a network location (and changed the FT to point to it) and it no longer works.

 

The reason this process is a problem is for the process to work it would require all 28 of my workstations to have the VB script and bitmap files loaded on to the local hard drives instead of having those resource files housed in a central library.

 

So you have set the VB Script data path in Mastercam's Configuration to point to this network location?

*ScriptLinker always runs the named VBS file assuming it is in that configured path location.

If so, have you tried leaving the DLL & FT files in the CHooks folder and just placed the VBS file in that configured location out on the network?

 

FYI...

After ScriptLinker builds the DLL, the "external" bitmap files are no longer needed,

as ScriptLinker has embedded them into the DLL (as "resources").

Link to comment
Share on other sites

Roger:

 

I have tried having only the VB script file on the network drive but it seems that the controlling factor in ScriptLinker on where the DLL file is created is the location of the VB script file so every time I try to link a script I get the same error as above. Do you think that some changes in some Windows settings can help?

 

Thanks

Link to comment
Share on other sites

Yes, by default ScriptLinker places the new DLL in the same folder as the VBS you've selected to be "linked".

That doesn't mean that it must stay there. If you relocate the DLL, you should just need to update the DLL's path that is specified in the related FT file.

From wherever the DLL is that Mastercam fires off (as defined in the FT), that DLL which was created by ScriptLinker will (attempt) to call the <your name here>.VBS in the VB Script folder as defined in Mastercam's configuration.

 

In essence, what ScriptLinker does is quite simple...

To be able to tie a command to a toolbar and/or a keymap, that command's "file" must contain either Win32 style resources (e.g. a CHook) or .NET style Resources (for a NETHook).

A VBS Script file doesn't have "resources", thus the need for ScriptLinker.

The required resource items are ->

1> A textual "TipString".

2> Two (BMP) images (16x16 and 24x24) for the small/large icon which Mastercam will display on the toolbar.

You then need an Function Table (FT) file that informs Mastercam of ->

The DLL that contains these resource items and of course the command function to be run.

And a few other items, which Customize-Category the command's icon should appear, etc.

 

ScriptLinker is a NETHook that creates a (very simple) NETHook style DLL and an FT file.

The only things in this NETHook that gets created are:

The resource items you've given it and a simple 'Run this VB Script' command.

In addition to the "myRes" named resource with your resource items embedded within the DLL,

here is the all of actual executable code within a ScriptLinker created DLL -->

*Here the VBS I asked ScriptLinker to "link" was the askColor.vbs (supplied as a sample with ScriptLinker).

*** I've added the //comments ***

 

public override MCamReturn Run(int param)
{
   // The VBS file name that we've asked to be processed.
   this.filename = "askColor.vbs";
   // Retrieve the VB Scripts path from Mastercam's config.
   this.path = ExternalAppsManager.CurrentVBScriptPath;
   // Combine the path and filename together to make a complete path to the VBS.
   this.vbs = Path.Combine(this.path, this.filename);
   // Tell Mastercam to run this VB Script.
   ExternalAppsManager.RunVBScript(this.vbs);
   return MCamReturn.NoErrors;
}

 

Do you think that some changes in some Windows settings can help?

Not that I'm aware of.

Link to comment
Share on other sites

I have tried creating the DLLs on my local drive and then moving them to the network drive and changing the path in the FT file but it does not work. when I point the FT file to the network all I get is the Mastercam X on the buttons and when I click on any button I get a can not find file error. When I move all of the DLLs back to my local drive and repoint the FT files back to the local drive everything works. This only happens on Mastercam X6, not on Mastercam X5.

Link to comment
Share on other sites

I spent hours on this yesterday. :wallbash:

Which told me enough that it is a .NET Framework v4 vs. earlier versions of the .NET Framework issue.

But not much else.

I finally found a clue that allowed me to confirm that fact

and even better I was just able to run down a solution.

 

If you're interested in the background on this...

 

*** You can substitute "network" for Web site and "Intranet" for Internet and you have our situation. ***

 

In the .NET Framework version 3.5 and earlier versions, if you loaded an assembly from a remote location, the assembly would run partially trusted with a grant set that depended on the zone in which it was loaded. For example, if you loaded an assembly from a Web site, it was loaded into the Internet zone and granted the Internet permission set. In other words, it executed in an Internet sandbox. If you try to run that assembly in the .NET Framework version 4, an exception is thrown; you must either explicitly create a sandbox for the assembly, or run it in full trust.

 

The <loadFromRemoteSources> element lets you specify that the assemblies that run partially trusted in earlier versions of the .NET Framework should be run fully trusted in the .NET Framework 4.

 

And a solution to allow your NETHook DLL to be able to be run from your network location? :thumbsup:

Is absolutely simple...

 

Add this XML data just as shown into a file named -> "mastercam.exe.config"

and place it into the main Mastercam X6 folder. (along with "mastercam.exe")

<configuration>
  <runtime>
     <loadFromRemoteSources enabled="true"/>
  </runtime>
</configuration>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...