2

Introduction:

I'm programing a CNC machine. To be exact a Rover from Biesse. The editor from the software that is used to programing support VBScript. VBScript is used for implementing conditional statments and loops etc. In instruction to the software i have listed all syntax from VBScript marked as not to be used to avoid complication :)

Of course I would like to use VBScript :) To be exact - to open txt file and set up program base on the content.

The main problem: All the syntax of the VBScript is valid e.g.:

Dim dic
Set dic = CreateInstance("Scripting.Dictionary")

compiles, but:

Dim fso
Set fso = CreateInstance("Scripting.FileSystemObject")

throws error/exepction:

ActiveX component can't create object: 'Scripting.FileSystemObject'

I tried and checked many solution connected to unregistered dlls etc. All seems valid and be ok. Also i checked a simple script .wsf

<package>
<job>
<script language="VBScript">
set fso = CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile("c:\BiesseMacros\RemoteTest.txt", true)
fout.WriteLine Now
fout.Close
</script>
</job>
</package>

It compiles and works. the situation is same on 4-5 different PC.

It all seems to be connected to the software not accepting components not marked as Safe for Scripting and Initialization ? Is it possible? I think it is something what is set up in project of application. App is on computer that won't connect to the internet, works on Windows XP. I know it is a bad idea to mark this component as safe, but i really want to. It will save me a couple of months of work (and life ;).

The question:

Is it possible and how to mark Scripting.FileSystemObject as Safe For Scripting?

Zaczes
  • 41
  • 6
  • See, if this [**link**](http://stackoverflow.com/a/660081/1652222) might help you. Did you check with software provider on this issue? – ManishChristian Jan 20 '17 at 14:14
  • Been there, done that. @ManishChristian This is where i started suspecting the software side. [similar issue, but he has his own open project of app](http://stackoverflow.com/a/28361730/5284111) Also .. Software provider won't help me - because as i wrote - they suggesting not to use VBScript syntax at all - the editor is not for strict programers - but for CNC programers – Zaczes Jan 20 '17 at 15:01
  • How about this [**link**](https://msdn.microsoft.com/en-us/library/aa751977(VS.85).aspx)? If this won't help you than unfortunately I don't have any other clue. – ManishChristian Jan 20 '17 at 15:21
  • working on that link now – Zaczes Jan 20 '17 at 15:38
  • 1
    @ManishChristian I found an answer digging the topics you pointed, posted it under this post. Thank you for your input! – Zaczes Jan 23 '17 at 10:07

1 Answers1

1

This link helped me out. In my case, I had to only create the key in registry

"Implemented Categories"

in HKCR\CLSID\"id's Scripting.FileSystemObject"

In this key i created same key as Scripting.Dictionary has:

enter image description here

and Voila!

Software recognize this object as safe.

Be advice!:

It can be harmful for your system - because it should not be marked as safe. In this way some pages could use the object without notification to manipulate your files! It is working for me - because the PC has no internet connection and that was the only way to trick the 3rd party software to use this object!

Zaczes
  • 41
  • 6