FreeMASTER and VBScript

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeMASTER and VBScript

Jump to solution
1,575 Views
abhisheksaxena
Contributor II

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.

Labels (1)
0 Kudos
1 Solution
1,085 Views
jefersonip
Contributor III

1 - Run the project in freeMaster

my freemaster project runing.PNG

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:

my file.PNGresult.PNG

See if that helps.

View solution in original post

5 Replies
1,085 Views
jefersonip
Contributor III

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?

1,085 Views
abhisheksaxena
Contributor II

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?

0 Kudos
1,086 Views
jefersonip
Contributor III

1 - Run the project in freeMaster

my freemaster project runing.PNG

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:

my file.PNGresult.PNG

See if that helps.

1,085 Views
abhisheksaxena
Contributor II

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.

0 Kudos
1,085 Views
jefersonip
Contributor III

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

0 Kudos