Hey guys,
Is it possible to execute a VBS script with reference to FreeMASTER's invisible ActiveX control OUTSIDE of FreeMaster? I want to to execute FreeMASTER commands from the command line just by executing VBS scripts.
If this message does not belong in the space that I've put it please feel free to move it to the appropriate one.Thanks for your valuable time and support.
Solved! Go to Solution.
1 - Run the project in freeMaster
2 - Create .vbs file in the work area as follows:
'-------------------------------------------------------------------------
Option Explicit
'On Error Resume Next
Dim FMObj
Dim succ
Dim tValue
Dim vValue
Dim bsRetMsg
tValue = 0
Set FMObj = CreateObject("MCB.PCM")
succ = FMObj.ReadVariable("var_test_count", vValue, tValue, bsRetMsg)
WScript.Echo tValue
WScript.Quit
'-------------------------------------------------------------------------
In my case saved as teste.vbs
Note that this very similar to yours.
3 - Run the .vbs file and in my case the result was:
See if that helps.
Hello Friend,
If I understand your question, I think WHAT you are trying to match the chapter
Chapter 6 HTML and the FreeMASTER documentation SCRIPTING. ( file:pcm_um.pdf : FreeMASTER for Embedded Applications User Guide)
That's right?
Hey Jeferson,
Thanks for your reply it gave me some hints. I'm using this code and I execute it with
CSCRIPT.
-------------------------------------------------------------------------
Option Explicit
'On Error Resume Next
Dim FMObj
Dim succ
Set FMObj = CreateObject("MCB.PCM")
succ = FMObj.ReadVariable("Speed", vValue, tValue, bsRetMsg)
WScript.Echo tValue
WScript.Quit
-------------------------------------------------------------------------
However I am getting an error message. Microsoft VBScript runtime error: ActiveX component can't create object: 'MCB.PCM'
I got the ActiveX object name from Chapter 6.1 after reading Chapter 6. Any ideas what is the right way to call the ActiveX from a VBS Script?
1 - Run the project in freeMaster
2 - Create .vbs file in the work area as follows:
'-------------------------------------------------------------------------
Option Explicit
'On Error Resume Next
Dim FMObj
Dim succ
Dim tValue
Dim vValue
Dim bsRetMsg
tValue = 0
Set FMObj = CreateObject("MCB.PCM")
succ = FMObj.ReadVariable("var_test_count", vValue, tValue, bsRetMsg)
WScript.Echo tValue
WScript.Quit
'-------------------------------------------------------------------------
In my case saved as teste.vbs
Note that this very similar to yours.
3 - Run the .vbs file and in my case the result was:
See if that helps.
Thanks for the reply Jeferson. I am using windows10 and I tried with the given code by you then it executed it. It shows an error " teste.vbs(11, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'MCB.PCM'". Please let me know what can be the probable solution for this now. I am using windows10
Thanks in advance.
I do not have windows 10 for testing, but a look at the link below can help you.
http://stackoverflow.com/questions/656934/activex-component-cant-create-object