FreeMASTER and VBScript

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FreeMASTER and VBScript

ソリューションへジャンプ
3,198件の閲覧回数
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.

ラベル(1)
0 件の賞賛
返信
1 解決策
2,708件の閲覧回数
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.

元の投稿で解決策を見る

5 返答(返信)
2,708件の閲覧回数
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?

2,708件の閲覧回数
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 件の賞賛
返信
2,709件の閲覧回数
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.

2,708件の閲覧回数
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 件の賞賛
返信
2,708件の閲覧回数
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 件の賞賛
返信