Application example – Flintec II IPC User Manual

Page 36

Advertising
background image

FlintWeigh II IPC Technical Manual, Rev. 1.06 November 2011

Page 36 of 36

11.2. Application Example


Example 1 – Visual Basic:

Call of OLE function "Regist" in VB

-------------------------------------------------------
Dim scale As Object
'Create object and position the weight display
'(only once in the programme during initialisation)
Set scale = CreateObject("scale99.serv")
Call scale.Position(0,0)

'Recording
'(several times during normal operation)
print_str = scale.Record

'Stop communication
'(only once in the programme before closing)
Call scale.Stop
-------------------------------------------------------



Example 2 - VisualBasicScript / Windows Scripting Host:

Call of OLE function "Regist2" in VBS

'------------------------------------------------------------
' Sample programme for use of OLE connection to FlintWeigh II
'------------------------------------------------------------
'## Create Shell-Object ##
Set ws = CreateObject("WScript.Shell")

'## Create OLE-Object for "

FlintWeigh II " ##

Set scale = CreateObject("Scale99.Serv")

'## First neccesary command to "

FlintWeigh II "=position(x,y) ##

scale.position 0,0

'## Info message and waiting till "

FlintWeigh II " is ready ##

ws.popup "Wait for initialisation of OLE server" ,1
WScript.Sleep (10*1000)

'## Show FlintWeigh II window ***
scale.Show

'## Wait for scale is ready and do recording–format 2 ##
Do
regist2value = scale.regist2
Loop Until (left(regist2value,1)<>"E")

'## Show result of recording – format 2 ##
msgbox regist2value

'## Stop OLE-Server ##
scale.stop
'----- End of Sample programme -----



















www.flintec.com

Advertising