You are on page 1of 71

E3.

Tools
Technical Inquiries
Please ask the responsible contact person in our support department.
E-mail: e3-support@zuken.com

Note:
Zuken is not responsible for any errors, which may appear in this documentation.
Liability, due to direct and indirect losses resulting from the delivery or use of this
documentation, is excluded to the extent permitted by law. This documentation
contains copyrighted information.
All rights, especially those pertaining to the duplication and distribution as well as the
translation, are reserved. This documentation, whether wholly or in part, may not be
reproduced in any form (photocopy, microfilm, etc.), or processed, duplicated or
distributed using an electronic system without Zukens prior written consent.

Contact
Zuken E3 GmbH
Laemmerweg 55
D-89079 Ulm/Einsingen

Phone : +49 7305 9309-0


Fax:+49 7305 9309-99
Web: http://www.zuken.com
E-mail: e3-info@zuken.com

Copyright 2010, Zuken E3 GmbH

www.zuken.com/e3

1 ..................................................................................................................... 2
1.1 64 Bit Operating System .............................................................................. 2
2 E3.Tools.Toolbar ................................................................................................. 3
2.1 .............................................................................................................. 3
2.1.1 ..................................................................................... 3
2.1.2 ............................................................................................ 4
3 E3.Tools.Dialog ................................................................................................... 6
3.1 DialogResult ........................................................................... 6
3.2 Open/Search File ............................................................................ 7
3.3 Save as ........................................................................................... 8
3.4 Select Folder ................................................................................... 9
4 E3.Tools.Data.................................................................................................... 10
4.1 Lists/Arrays ........................................................................................ 10
5 E3.Tools.IODialog ............................................................................................. 11
5.1 ............................................................................................................ 11
5.2 ................................................................................................. 15
5.2.1 ....................................................................................... 15
5.2.2 ....................................................................................... 15
5.2.3 ....................................................................................... 16
5.2.4 ....................................................................................... 16
5.3 ..................................................................................................... 18
6 E3.Tools.Owners ............................................................................................... 20
6.1 ..................................................................................................... 20
6.2 .............................................................................................. 20
6.3 Owner designation .................................................................. 21
6.4 .......................................................................................... 22
7 E3.Tools.ListBoxDialog ..................................................................................... 23
7.1 ............................................................................................................ 23
7.2 ..................................................................................................... 23
7.2.1 .......................................................................................... 23
7.2.2 ..................................................................................................... 24
7.2.3 ..................................................................................................... 25

www.zuken.com/e3 I
7.3 ..................................................................................................... 26
8 E3.Tools.TreeViewDialog .................................................................................. 28
8.1 ............................................................................................................ 28
8.2 ............................................................................................................ 28
8.2.1 .......................................................................................... 28
8.2.2 ..................................................................................................... 29
8.2.3 ..................................................................................................... 30
8.3 ..................................................................................................... 31
9 E3.Tools.FilterDialog ......................................................................................... 33
9.1 ............................................................................................................ 33
9.1.1 ..................................................................................................... 33
9.1.2 ..................................................................................................... 33
9.2 ..................................................................................................... 34
9.2.1 .......................................................................................... 34
9.2.2 ..................................................................................................... 34
9.2.3 ..................................................................................................... 35
9.3 ..................................................................................................... 36
10 E3.Tools.Translation ...................................................................................... 38
10.1 ........................................................................................................ 38
10.2 ........................................................................................................ 38
10.2.1 Initialize ............................................................................................... 38
10.2.2 GetString ............................................................................................. 39
10.2.3 XML ........................................................................... 40
10.3 .......................................................................................... 42
11 E3.Tools.IniFile .............................................................................................. 43
11.1 ........................................................................................................ 43
11.2 ........................................................................................................ 43
11.2.1 GetValue ............................................................................................. 43
11.2.2 GetSectionNames ............................................................................... 44
11.2.3 GetSection .......................................................................................... 44
11.2.4 WriteValue........................................................................................... 45
11.2.5 WriteSection ........................................................................................ 46
11.2.6 DeleteValue......................................................................................... 46

www.zuken.com/e3 II
11.2.7 DeleteSection ...................................................................................... 47
11.3 ................................................................................................. 47
12 E3.Tools.VBSForm ........................................................................................ 49
12.1 ........................................................................................................ 49
12.2 ........................................................................................................ 49
12.2.1 SetDialogPos ...................................................................................... 49
12.2.2 Show ................................................................................................... 50
13 E3.Tools.TableToSheetGenerator ................................................................. 53
13.1 Properties ...................................................... Error! Bookmark not defined.
13.2 Functions....................................................... Error! Bookmark not defined.
13.3 Table Structure .............................................. Error! Bookmark not defined.
13.4 Error Messages ............................................. Error! Bookmark not defined.
14 E3.Tools.ScriptControl ................................................................................... 60
14.1 Functions....................................................... Error! Bookmark not defined.
14.1.1 AddObject ........................................................................................... 60
14.1.2 Run ..................................................................................................... 60
14.1.3 Reset ................................................................................................... 60
14.2 Properties ...................................................... Error! Bookmark not defined.
14.2.1 Language ............................................................................................ 60
14.2.2 ScriptFullName.................................................................................... 61
14.2.3 Error .................................................................................................... 61
14.3 Sample Script ................................................ Error! Bookmark not defined.
15 E3.Tools.AssemblyInfos ................................................................................ 63
15.1 Properties ...................................................... Error! Bookmark not defined.
15.1.1 AssemblyPath ..................................................................................... 63
15.1.2 AssemblyVersion ................................................................................ 63
15.1.3 AssemblyName ................................................................................... 63
15.2 Functions....................................................... Error! Bookmark not defined.
15.2.1 CompareVersion ................................................................................. 63
15.3 Example ..................................................................................................... 64

www.zuken.com/e3 III
www.zuken.com/e3 IV

E3.Tools

www.zuken.com/e3 1
1
E3.Tools ( E3.Tools)
TOOLS/E3.Tools Setup.exe
E3.Tools

1.1 64 Bit Operating System

There is a 64 Bit version for E3.Tools. We recommend the E3.Tools version to


correspond to the E.series version. That means, when using 64 Bit E.series, the 64
Bit version of E3.Tools must be used.
The following description only applies when the 32 Bit version of E.series is running
on a 64 Bit operating system:
When you want to create an instance of E3.Tools using a script, please ensure that
the script is executed with the 32 Bit Scriptinghost, which is stored in the
C:\WINDOWS\SysWOW64 directory. The explorer connection of the vbs file
(when double-clicking) will refer to the 64 Bit version, thus we recommend to create
a connection C:\WINDOWS\SysWOW64\wscript.exe myscript.vbs, in case the
script is often used.
When E3.Tools is instantiated from a 64 Bit process, the system displays the
following error: Cannot create ActiveX Object. When starting the script from within
E3.series, E3.Tools performs as on a 32 Bit operating system.

www.zuken.com/e3 2
2 E3.Tools.Toolbar
VB E3

2.1

2.1.1

E.series
E.series

E.series

HKEY_LOCAL_MACHINE\SOFTWARE\Zuken\E3.series\<version>1)\Plugin
s

NOTE: When working on a 64 Bit operating system, the basic key must be enhanced as follows:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Zuken\E3.series\<Versi
on>1)\Plugins

1)
8.0 = E.series 2007
9.0 = E.series 2008
10.0 = E.series 2009
11.0 = E.series 2010

www.zuken.com/e3 3
E3.Toolbar

Name ()
Object (E3.Tools.Toolbar)
Type (0)
Height (16)
Width (
E.series ) XML width
0

2.1.2

E.series
XML

(1)

(3)

(4)

www.zuken.com/e3 4
Type

1 =
2 =
3 =
4 =

E3.Tools.Toolbar.config.xml
E3_TOOLBAR_CONFIG_FILE
E3.Tools.dll
E3.Tools.Toolbar.config.xml

btn1

o cmd ()
o cmdargs (| (pipe)
o key ()
o icon ()
o tooltip ()
o type ( 1= / 2= / 3= / 4= )
o name ( XML )

TB

TB.ActiveKey
TB.Buttons .nametypeCmd
CmdArgs

EnableButton()
DisableButton()

ToolbarAllKeys.vbs ToolbarExampleScript.vbs.

www.zuken.com/e3 5
3 E3.Tools.Dialog

3.1 DialogResult

DialogResult

o Yes =6
o No =7
o Abort =3
o Cancel =2
o Ignore =5
o None =0
o Retry =4
o Open =1
o OK = 1 (/)

www.zuken.com/e3 6
3.2 Open/Search File

Set dlg = CreateObject("E3.Tools.Dialog")

Filename = dlg.ShowOpen( "Open Title", "C:\temp", "", "E3S |


*.e3s" )
MsgBox Filename & "-" & dlg.DialogResult

ShowOpen Title, InitialDirectory, InitialFilename, Filter,


Multiselect

Title

InitialDirectory
.
InitialFileName

Filter
*.*

3.1
Multiselect
Enable selection of several files
When activated, the return string contains all file names separated by |

www.zuken.com/e3 7
3.3 Save as

Set dlg = CreateObject("E3.Tools.Dialog")

Filename = dlg.ShowSave ( "Save as", "C:\PRJ", "", "E3S |


*.e3s" )
MsgBox Filename & "-" & dlg.DialogResult

ShowSave Title, InitialDirectory, InitialFilename, Filter

Title

InitialDirectory
.
InitialFileName

Filter
*.*

3.1

www.zuken.com/e3 8
3.4 Select Folder

Filename = dlg.ShowDirectoryBrowser("Test")
MsgBox Filename & "-" & dlg.DialogResult

:
ShowDirectoryBrowser Desc, InitialDirectory

Desc

InitialDirectory
.

3.1

www.zuken.com/e3 9
4 E3.Tools.Data

4.1 Lists/Arrays

o SortArrayAlpha ()
o SortArrayAlphaNumeric ()
o SortArrayNumeric ()

Set mylist = CreateObject("Scripting.Dictionary")


Set dta = CreateObject("E3.Tools.Data")

mylist.add "A11", "A11"


mylist.add "A2", "A2"
mylist.add "A1", "A1"
mylist.add "A20", "A20"

mysimplearr = Array("11", "2", "1", "20")

tmpstr = ""
Set sortedarr = dta.SortArrayAlpha( mylist.keys )
For each value in sortedarr
tmpstr = tmpstr & value & vbcr
Next
MsgBox tmpstr

tmpstr = ""
Set sortedarr = dta.SortArrayAlphaNumeric( mylist.items )
For each value in sortedarr
tmpstr = tmpstr & value & vbcr
Next
MsgBox tmpstr

tmpstr = ""
Set sortedarr = dta.SortArrayNumeric( mysimplearr )
For each value in sortedarr
tmpstr = tmpstr & value & vbcr
Next
MsgBox tmpstr

www.zuken.com/e3 10
5 E3.Tools.IODialog
/

5.1

E3.Tools.IODialog Write WriteLn

www.zuken.com/e3 11
IODialog Read()

2 IODialog

www.zuken.com/e3 12
3

www.zuken.com/e3 13

www.zuken.com/e3 14
5.2

5.2.1

E3.Tools.IODialog COM VBS

Set IODialog = CreateObject(E3.Tools.IODialog)

5.2.2

Title [<String>]

Width [<Integer>]

Height [<Integer>]

Top [<Integer>]
.

Left [<Integer>]

TopMost [<Boolean>]

Visible [<Boolean>]

Close window
X
invisible (Visible = false)
Ask value = -2 / read value = -4711

www.zuken.com/e3 15
5.2.3

Write <string> [,color]


&Hrrggbb. Write
(Visible = true)

WriteLn <string> [,color]


&Hrrggbb Write
(Visible = true)

Font [<System.Drawing.Font>]

GetText

Clear

Read <question>, <timeout> [, <default>]


2
<question>Timeout timeout -1
<default>
Read

Ask <question>, <timeout>, <Button1-Text>, , <Button2-Text> , <Button3-Text>,


<default>
3
<question>Timeout timeout -1
<default>
<ButtonX-Text>
<default>
1 3
Read

5.2.4

ProgressMinimum [<Integer>]

ProgressMaximum [<Integer>]

www.zuken.com/e3 16
ProgressValue [<Integer>]

ProgressIncrement [<Integer>]

ProgressPerformStep
ProgressStep

ProgressStep [<Integer>]
ProgressPerformStep

ProgresssVisible [<Boolean>]

www.zuken.com/e3 17
5.3
Set IODialog = CreateObject("E3.Tools.IODialog")

IODialog.Title = "Test IODialog"

IODialog.width = 400
IODialog.height = 600
'Switch off Progress bar
IODialog.ProgressVisible = false

IODialog.WriteLn "Dialog is top-most."


IODialog.TopMost = true

'The dialog is still invisible. It becomes visible


automatically by "Write(Ln)"
IODialog.Write "Output with" & vbcrlf & " manual carriage
return." & vbcrlf

IODialog.Write "Output with color: #FF2245" & vbcrlf, &HFF2245

IODialog.WriteLn "Output with automatic carriage return."

IODialog.WriteLn "Output with automatic carriage return and


color.", &H0000aa

IODialog.WriteLn "Dialog is not top-most."


IODialog.TopMost = false

'txt = IODialog.GetText
'msgbox txt

'Question, Timeout, default answer


ant = IODialog.Read("Answer to Life, Universe and Everything?
" & vbcrlf, 5, "42") 'Timeout in seconds
If ant = "42" Then
IODialog.WriteLn "Correct!!"
End if

www.zuken.com/e3 18
IODialog.TopMost = true

'Question, Timeout, NO default answer


ant = IODialog.Read("Answer to Life, Universe and Everything?
" & vbcrlf, 5) 'Timeout in seconds
If ant = "42" Then
IODialog.WriteLn "Correct!!"
End If
'Print some lines
IODialog.WriteLn "Printing some lines..."
For n=0 to 10
IODialog.WriteLn "Line No.: " & n
Next

'Question, timeout, 2 buttons, default button number


ant = IODialog.Ask("Answer to Life, Universe and Everything? "
& vbcrlf, 10, "42", "41", "", 1)
IODialog.WriteLn "Button No. pressed: " & ant

'Question, timeout, 3 buttons, default button number


ant = IODialog.Ask("Answer to Life, Universe and Everything? "
& vbcrlf, 10, "42", "666", "23", 2)
IODialog.WriteLn "Button No. pressed: " & ant

'Show progress bar


IODialog.ProgressVisible =true

'set progress bar params


IODialog.ProgressMinimum = 0
IODialog.ProgressMaximum = 1000
IODialog.ProgressValue = 0
IODialog.WriteLn "Printing some lines..."
IODialog.WriteLn "and updating the progress bar"
For n=0 to 1000
IODialog.WriteLn "Line No.: " & n
IoDialog.ProgressIncrement 1
Next

wscript.sleep 3000
'Clear output window
IODialog.Clear
'wait befor closing
IODialog.WriteLn "Demo finished"
wscript.sleep 3000
set IODialog = nothing

www.zuken.com/e3 19
6 E3.Tools.Owners
6.1

OwnerAttributeDefinition
E.series

Kabeltyp () Cable type () CABLETYPE

6.2

Dim oE3TO
Dim AttributeOwnerDict
Dim key
Dim AttributeOwners_str
Dim language_code

language_code = "44" 'any language code can be defined

Set oE3TO = CreateObject("E3.Tools.AttributeOwners")

Set AttributeOwnerDict =o E3TO.GetAllAttributeOwners(language_code)

AttributeOwners_str = "<Key> : <Value>" & vbcrlf


For Each key In AttributeOwnerDict.keys
AttributeOwners_str = AttributeOwners_str & key & ": " &
AttributeOwnerDict(key) & vbcrlf
Next
MsgBox AttributeOwners_str

Set oE3TO = Nothing

www.zuken.com/e3 20
6.3 Owner designation

OwnerAttributeDefinition
E.series
Long Int64 5.2 .

Dim oE3TO
Dim AttributeOwnersDict
Dim oOwner
Dim key
Dim AttributeOwners_str
Dim language_code

language_code = "44" 'english


Set oE3TO = CreateObject("E3.Tools.AttributeOwners")
Set AttributeOwnersDict = oE3TO.GetAttributeOwnersToValue(4 Or 8 Or
32 , language_code)

AttributeOwners_str = "<Key> : <Value>" & vbcrlf

For Each key In AttributeOwnersDict.keys


AttributeOwners_str = AttributeOwners_str & key & " : " &
AttributeOwnersDict(key) & vbcrlf
Next

MsgBox AttributeOwners_str

Set oE3TO = Nothing

www.zuken.com/e3 21
6.4

Dim AttributeOwners_str
Dim oE3TO
Set oE3TO = CreateObject("E3.Tools.AttributeOwners")

AttributeOwners_str = oE3TO.GetAttributeOwner("CABLETYPE", "1") & vbcrlf & _

oE3TO.GetAttributeOwner("CABLETYPE", "033") & vbcrlf & _


oE3TO.GetAttributeOwner("CABLETYPE", "034") & vbcrlf & _
oE3TO.GetAttributeOwner("CABLETYPE", "044") & vbcrlf & _
oE3TO.GetAttributeOwner("CABLETYPE", "049") & vbcrlf & _
oE3TO.GetAttributeOwner("CABLETYPE", "351") & vbcrlf & _
oE3TO.GetAttributeOwner("CABLETYPE", "390")

MsgBox AttributeOwners_str

Set oE3TO = Nothing

www.zuken.com/e3 22
7 E3.Tools.ListBoxDialog

7.1

7.2

7.2.1

E3.Tools.ListBoxDialog VB COM

Set IODialog = CreateObject(E3.Tools.ListBoxDialog )

www.zuken.com/e3 23
7.2.2

CancelButtonText <string>
Cancel

CheckAllText <string>
CheckAll

CheckBoxMultiSel <boolean>

True = , False = (True)

Column <integer>

columnWidth(ByVal col As Long) As Long

Height <integer>

Label <string>

OkButtonText <string>
OK

showLabel <boolean>

Title <string>

Width <integer>

xPos <integer>
X
()

yPos <integer>
Y
()

www.zuken.com/e3 24
7.2.3

addIcon(iconPath as String)

AddItem(ByVal Item As String, [ByVal isChecked As Long = 0], [ByVal


imageIndex As Long = 0])

Item = Wert
isChecked = (0=off/1=on)
imageIndex = ()

AddSubItem(ByVal Item As String)


(2nd/3rd )

getCheckedItems As System.Collections.ArrayList
ArrayList

getSelectedItem As String

getSelectionArray As System.Collections.ArrayList
ArrayList

initListBox(ByVal columns As Long, [ByVal style As Long = 0], [ByVal


UseCheckBoxes As Long = 0], [ByVal UseMultiSelection As Long = 0], [ByVal
UseImageList As Long = 0])

Columns =
style = (0=/1=/2=/3=/4=)
UseCheckBoxes= 0=off/1=on
UseMultiSelection= 0=off/1=on
UseImageList= 0=off/1=on

inList(ByVal Item As String) As Boolean


true!

ItemCount As Long

ShowDialog() As System.Windows.Forms.DialogResult
Displays the ListBoxDialog form as modal dialog. OK1(vbOK)
2(vbCancel)

www.zuken.com/e3 25
7.3
Option Explicit

Dim ListBoxDialog : Set ListBoxDialog = CreateObject("E3.Tools.ListBoxDialog")


Dim e3App : Set e3App = CreateObject("CT.Application")
Dim e3Job : Set e3Job = CreateObject("CT.Job")
Dim e3Dev : Set e3Dev = CreateObject("CT.Device")

' initialize ListBoxDialog


' (Columns=3, Style=1, UseCheckBoxes=1, UseMultiSelection=1, UseImageList=0)
ListBoxDialog.initListBox 3,1,1,1,0

' set the Position and Size of ListBoxDialog


ListBoxDialog.xPos = 50
ListBoxDialog.yPos = 50
ListBoxDialog.Width = 400
ListBoxDialog.Height = 300

' set Title


ListBoxDialog.Title = "Example Title"

' set Label


ListBoxDialog.label = "Choose a Device"
ListBoxDialog.showLabel = True

' set Column-Names


ListBoxDialog.Column(1) = "Device"
ListBoxDialog.Column(2) = "Location"
ListBoxDialog.Column(3) = "Assignment"

' fill ListBoxDialog with Data from E3


Dim devCnt, devIds, devId
devCnt = e3Job.GetAllDeviceIds(devIds)
For Each devId in devIds
e3Dev.SetId devId
If Not ListBoxDialog.inList(e3Dev.GetName) Then
ListBoxDialog.AddItem e3Dev.GetName
ListBoxDialog.AddSubItem e3Dev.GetLocation
ListBoxDialog.AddSubItem e3Dev.GetAssignment
End If
Next

' show ListBoxDialog


ListBoxDialog.ShowDialog

' fill Array with checked Items


Dim chItemsArr, tmpString
Set chItemsArr = ListBoxDialog.getCheckedItems
Dim item
For Each item In chItemsArr
tmpString = tmpString & item & vbCrLf
Next

www.zuken.com/e3 26
' show checked items in MessageBox
If tmpString <> "" Then
MsgBox tmpString,,"Checked Items"
Else
MsgBox("No Items checked...")
End If

' cleanup
Set e3dev = Nothing
Set e3job = Nothing
Set e3app = Nothing
Set ListBoxDialog = Nothing

Next

' show checked items in MessageBox


If tmpString <> "" Then
MsgBox tmpString,,"Checked Items"
Else
MsgBox("No Items checked...")
End If

' cleanup
Set e3dev = Nothing
Set e3job = Nothing
Set e3app = Nothing
Set ListBoxDialog = Nothing

www.zuken.com/e3 27
8 E3.Tools.TreeViewDialog
/

8.1

8.2

8.2.1

E3.Tools.ListBoxDialog VB COM

Dim TVDialog
Set TVDialog = CreateObject(E3.Tools.TreeViewDialog)

www.zuken.com/e3 28
8.2.2

CancelButtonText <String>

CheckBoxes <Boolean>

Height <Integer>

IconsVisible <Boolean>

LabelText <String>

LabelVisible <Boolean>

OkButtonText <String>
OK

PathSeperator <String>

SelectedImagesVisible <Boolean>

Title <String>

Width <Integer>

xPos <Integer>
x-
()

yPos <Integer>
y-
()

www.zuken.com/e3 29
8.2.3

addIcon( iconPath As String )

0 100 110

100 = 101 =
102 = 103 =
104 = 105 =
106 = 107 =
108 = 109 =
110 =

addNode( nodePath As String,


[checked As Boolean] : False,
[imageIndex As Integer] : 100,
[expandedImageIndex As Integer] : 101,
[selectedImageIndex As Integer] : 104,
[expSelImageIndex As Integer] : 105 )
checked
addIcon
(: CheckBoxes true)

collapse( nodePath As String )

collapseAll()

expand( nodePath As String )

expandAll()

getCheckedEndNodes() As System.Collections.ArrayList

getCheckedNodes() As System.Collections.ArrayList

getSelectedNode() As String

www.zuken.com/e3 30
ShowDialog() As System.Windows.Forms.DialogResult
OK1 (vbOK)
2(vbCancel)

8.3
Option Explicit

Dim TreeViewDialog : Set TreeViewDialog = CreateObject("E3.Tools.TreeViewDialog")

' the following Icons are built-in in TreeViewDialog Object


Const CFolderYellow = 100
Const OFolderYellow = 101
Const CFolderGrey = 102
Const OFolderGrey = 103
Const CFolderRed = 104
Const OFolderRed = 105
Const CFolderGreen = 106
Const OFolderGreen = 107
Const CFolderBlue = 108
Const OFolderBlue = 109
Const Sheet = 110

' add user-defined Icon(s) to the ImageList


TreeViewDialog.addIcon("..\..\logo.ico")

' view Icons infront of the Nodes


TreeViewDialog.IconsVisible = True
TreeViewDialog.SelectedImagesVisible = True

' set Title


TreeViewDialog.Title = "Example Title"

' set Label


TreeViewDialog.LabelText = "Example Text" & vbcrLf & _
" 1. Description" & vbLf & _
" 2. Description"
TreeViewDialog.LabelVisible = True

' enable Checkboxes


TreeViewDialog.CheckBoxes = True

' set the Text of the Ok-Button


TreeViewDialog.OkButtonText = "&OK"

' set the PathSeperator for the Nodes


Dim PS : PS = "\\"
TreeViewDialog.PathSeperator = PS
MsgBox(TreeViewDialog.PathSeperator)

www.zuken.com/e3 31
' add the Nodes to the TreeViewDialog
' Sub addNode( nodePath As String,
' Optional checked As Boolean = False,
' Optional imageIndex As Integer = CFolderYellow,
' Optional expandedImageIndex As Integer = OFolderYellow,
' Optional selectedImageIndex As Integer = CFolderRed,
' Optional expSelImageIndex As Integer = OFolderRed )
Dim x, y, z
For x = 1 To 2
For y = 1 To 1
TreeViewDialog.addNode "x"&x & PS & "y"&y, , CFolderYellow, OFolderYellow
For z = 1 To 5
TreeViewDialog.addNode "x"&x & PS & "y"&y & PS & "z"&z, , CFolderYellow, OFolderYellow
If z = 3 Then
' add checked Nodes with user-defined selectedIcon
TreeViewDialog.addNode "x"&x & PS & "y"&y & PS & "z"&z & PS & "1", True, Sheet, , 0
TreeViewDialog.addNode "x"&x & PS & "y"&y & PS & "z"&z & PS & "2", True, Sheet, , 0
' add unchecked Node with user-defined selectedIcon
TreeViewDialog.addNode "x"&x & PS & "y"&y & PS & "z"&z & PS & "3", , Sheet, , 0
End If
Next
Next
Next

' expand the whole Tree


TreeViewDialog.expandAll

' show TreeViewDialog


Dim result
result = TreeViewDialog.ShowDialog
If result = vbOk Then
MsgBox("""Ok"" Button pressed")
ElseIf result = vbCancel Then
MsgBox("""Cancel"" Button pressed")
End If

' get all checked Nodes from TreeViewDialog


Dim arrLst, tmp
Set arrLst = TreeViewDialog.getCheckedNodes
Dim node
For Each node In arrLst
tmp = tmp & node & vbCrLf
Next
MsgBox tmp, ,"Checked Nodes"

' get the selected Node


MsgBox TreeViewDialog.getSelectedNode, , "Selected Node"

' cleanup
Set TreeViewDialog = Nothing

www.zuken.com/e3 32
9 E3.Tools.FilterDialog

9.1

Export
ResultArray

9.1.1


Filter all data

9.1.2

Shift

www.zuken.com/e3 33
9.2

9.2.1

E3.Tools.ListBoxDialog VBS COM

Set FilterDialog = CreateObject(E3.Tools.FilterDialog)

9.2.2

AllowColumnsMove <boolean>
False

CloseOnExport <boolean>
True

DataTable <DataTable>
.NET DataTable

ExportButtonCaption <string>

ExportFile <string>

ExportFormat <string>

EXCEL, PDF, HTML, MHT, RTF, TEXT

FilterRowVisible <Boolean>
False

Icon <string>

Language <string>
44

Left <integer>

www.zuken.com/e3 34
Result <integer>

0 =
1 =

ResultArray <Array>
2
1 =
2 =

Title <string>

Top <integer>

TopMost <boolean>

Visible <boolean>

Width <integer>

9.2.3

addDataColumn(ByVal ColName As String, ColCaption as String) As Integer

ColNames=
= 0 / 1

addDataRow(ByRef rowValues As Object) As Integer

rowValues =

Clear()

ColCount() As Integer

Run(Optional ByVal FilterGridVisible As Boolean = True, Optional ByVal


DataGridVisible As Boolean = False) As Integer

www.zuken.com/e3 35
setColumnFilter(ByVal Column As String, Optional ByVal op1 As String = "",
Optional ByVal Value1 As String = "", Optional ByVal op2 As String = "",
Optional ByVal Value2 As String = "", Optional ByVal ChangeRow As Boolean =
True)

Column =
op1 =
Value1 =
Op2 =
Value2 =

setColumnWidth(ByVal Column As String, ByVal Width As Integer)

setSortOptions(ByVal spalte As String, ByVal type As Integer, Optional ByVal


Order As Integer = 0)

9.3
Set FilterDialog = CreateObject("E3.Tools.FilterDialog")
Set e3App = CreateObject("CT.Application")
Set e3Job = e3App.CreateJobObject
Set e3Dev = e3Job.CreateDeviceObject

'----------- Set columns in the data table --------------------------------


-----------------------
FilterDialog.addDataColumn "Name","xy"
FilterDialog.addDataColumn "Anlage"
FilterDialog.addDataColumn "Ort"

'----------- Get datas from project ---------------------------------------


-----------------------
devCnt = e3Job.getAllDeviceIds(devIds)
For i = 1 To devCnt
e3Dev.SetId(devIds(i))
If e3Dev.IsWireGroup <> 1 And e3Dev.IsAssembly <> 1 Then
FilterDialog.addDataRow
Array(e3Dev.GetName,e3Dev.GetAssignment,e3Dev.GetLocation)
End If
Next

'----------- Dictionary for the columns -----------------------------------


-----------------------
FilterDialog.setColumnWidth "Name", 250
FilterDialog.setColumnWidth "Anlage", 100
FilterDialog.setColumnWidth "Ort", 150

FilterDialog.setSortOptions "Name",1
FilterDialog.setSortOptions "Ort",1

www.zuken.com/e3 36
'----------- Dictionary with options --------------------------------------
-----------------------
Filterdialog.ExportFormat = "EXCEL"
FilterDialog.CloseOnExport = True
FilterDialog.AllowColumnsMove = True
FilterDialog.FilterRowVisible = True
FilterDialog.ExportButtonCaption = "&Weiter"
FilterDialog.ExportFile = "D:\Test.xls"
FilterDialog.Language = "49"

'----------- Dictionary mit SortOrder (Columnname / 0= Asc 1 = desc) ------


-----------------------
FilterDialog.setColumnFilter "Name", "=", "*"
FilterDialog.setColumnFilter "Anlage"
FilterDialog.setColumnFilter "Ort"

FilterDialog.title = "Neu"
FilterDialog.run True, True

www.zuken.com/e3 37
10 E3.Tools.Translation
10.1

10.2

10.2.1 Initialize

Initialize

Initialize(ByVal fileName As String, ByVal language As Integer,


Optional ByVal defaultLanguage As Integer = 44) As Boolean

filename:
language:
defaultLanguage: ( = 44)
: True
FALSE

www.zuken.com/e3 38
10.2.2 GetString

GetString

GetString(ByVal text As String, _


Optional ByVal arg0 As String = Nothing, _
Optional ByVal arg1 As String = Nothing, _
Optional ByVal arg2 As String = Nothing, _
Optional ByVal arg3 As String = Nothing, _
Optional ByVal arg4 As String = Nothing, _
Optional ByVal arg5 As String = Nothing, _
Optional ByVal arg6 As String = Nothing, _
Optional ByVal arg7 As String = Nothing, _
Optional ByVal arg8 As String = Nothing, _
Optional ByVal arg9 As String = Nothing) As String

text:
arg0-arg9 arg0 arg9
%s

www.zuken.com/e3 39
10.2.3 XML

XML XML

<?xml version="1.0" encoding="utf-8"?>


<Dictionaries>
<Dictionary Language="49">
<FromTo Phrase="A phrase">
<Translation>Eine Phrase</Translation>
</FromTo>
<FromTo Phrase="Another phrase">
<Translation>Noch eine Phrase</Translation>
</FromTo>
<FromTo Phrase="A %s phrase">
<Translation>Eine %s Phrase</Translation>
</FromTo>
<FromTo Phrase="A %s phrase is %s">
<Translation>Eine %s Phrase ist %s</Translation>
</FromTo>
</Dictionary>
<Dictionary Language="33">
<FromTo Phrase="A phrase">
<Translation>Une phrase</Translation>
</FromTo>
<FromTo Phrase="Another phrase">
<Translation>de plus phrase</Translation>
</FromTo>
</Dictionary>
</Dictionaries>

Language

www.zuken.com/e3 40

example language file
languages.lng

Set e3 = CreateObject("ct.application")
Set trans = CreateObject("E3.Tools.Translation")
Set fso = CreateObject("Scripting.FileSystemObject")

scriptPath = fso.GetParentFolderName(wscript.ScriptFullName)
scriptPath = scriptPath & "\" & "languages.lng"

If trans.Initialize(scriptPath, e3.GetInstallationLanguage(), 44) =


True Then
MsgBox trans.GetString("Translation")
MsgBox trans.GetString("Param", "MYPARAM")
End If

www.zuken.com/e3 41
10.3
<?xml version="1.0" encoding="utf-8"?>
<Dictionaries>
<Dictionary Language="49">
<FromTo Key="Translation">
<Translation>bersetzung</Translation>
</FromTo>
<FromTo Key="Param">
<Translation>Parameter '%s'</Translation>
</FromTo>
</Dictionary>
<Dictionary Language="44">
<FromTo Key="Translation">
<Translation>Translation</Translation>
</FromTo>
<FromTo Key="Param">
<Translation>Parameter '%s'</Translation>
</FromTo>
</Dictionary>
</Dictionaries>

www.zuken.com/e3 42
11 E3.Tools.IniFile
11.1

INI

11.2

IniFile

11.2.1 GetValue

GetValue( ByVal fileName As String, _


ByVal section As String, _
ByVal key As String, _
Optional ByVal defaultVal As String = "" ) _
As String

INI

fileName INI ()
section INI
key
defaultVal ()

255 255

www.zuken.com/e3 43
11.2.2 GetSectionNames

GetSectionNames( ByVal fileName As String ) _


As System.Collections.ArrayList

INI

Parameter:
fileName INI ()

Return value:
System.Collections.ArrayList

11.2.3 GetSection

GetSection( ByVal fileName As String, _


ByVal section As String ) _
As System.Collections.ArrayList

INI

fileName INI ()
section INI

System.Collections.ArrayList

www.zuken.com/e3 44
11.2.4 WriteValue

WriteValue( ByVal fileName As String, _


ByVal section As String, _
ByVal key As String, _
ByVal value As String ) _
As Boolean

INI

Windows

fileName INI ()
section INI
key
value

/ True False.

www.zuken.com/e3 45
11.2.5 WriteSection

WriteSection( ByVal fileName As String, _


ByVal section As String, _
ByVal secArray As Object ) _
As Boolean

secArray / INI

secArray key/value(key=value)
key/value secArray
secArray

Windows

fileName INI ()
section INI
secArray /

/ True False

11.2.6 DeleteValue

DeleteValue( ByVal fileName As String, _


ByVal section As String, _
ByVal key As String ) _
As Boolean

INI key/value

fileName INI ()
section INI
key

True False

www.zuken.com/e3 46
11.2.7 DeleteSection

DeleteSection( ByVal fileName As String, _


ByVal section As String ) _
As Boolean

INI

fileName INI ()
section

True False

11.3

test.ini INI
key/value
/

IniFileExample.vbs

Option Explicit

Const FILE = ".\test.ini"


Dim inifile : Set inifile = CreateObject("E3.Tools.IniFile")

Dim SEC, KEY, VAL, ARR


Dim i, tmp, item

'WriteValue Example
For i = 1 To 3
SEC = "KeyValSec"
KEY = "key"&i
VAL = CStr(Hex(i+9))
If Not(inifile.WriteValue(FILE, SEC, KEY, VAL))Then
MsgBox("Unable to write:" & vbCrLf & KEY & "=" & VAL)
End If
Next

www.zuken.com/e3 47
'WriteSection Example
SEC = "TextSec"
ReDim ARR(3)
For i = 1 To 3
ARR(i-1) = "Text"&i & "=" & i
Next
If Not(inifile.WriteSection(FILE, SEC, ARR))Then
MsgBox("Unable to write Section:" & vbCrLf & SEC)
End If

Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")


If( Not fso.FileExists( FILE ) ) Then
MsgBox("File """ & FILE & """ does not exist.")
WScript.Quit
End If

'GetSectionNames Example
Set ARR = inifile.GetSectionNames(FILE)
tmp = ""
For Each item In ARR
tmp = tmp & item & vbCrLf
Next
MsgBox("GetSectionNames:" & vbCrLf & tmp)

'GetValue Example
SEC = "KeyValSec"
KEY = "key2"
VAL = inifile.GetValue(FILE, SEC, KEY)
MsgBox("GetValue:" & vbCrLf & KEY & "=" & VAL)

'GetSection Test
SEC = "TextSec"
Set ARR = inifile.GetSection(FILE, SEC)
tmp = ""
For Each item In ARR
tmp = tmp & item & vbCrLf
Next
MsgBox("GetSection:" & vbCrLf & tmp)

'DeleteValue Test
SEC = "KeyValSec"
KEY = "key2"
If Not(inifile.DeleteValue(FILE, SEC, KEY))Then
MsgBox("Unable to delete Key:" & vbCrLf & KEY)
End If

'DeleteSection Test
SEC = "KeyValSec"
If Not(inifile.DeleteSection(FILE, SEC))Then
MsgBox("Unable to delete Section:" & vbCrLf & SEC)
End If

Set inifile = Nothing

www.zuken.com/e3 48
12 E3.Tools.VBSForm
VBSForm

12.1

Title <String>

12.2

12.2.1 SetDialogPos

SetDialogPos(ByVal Left As Integer, ByVal Top As Integer)

Left
Top

www.zuken.com/e3 49
12.2.2 Show

show(Optional ByRef questions As Object = 0, Optional ByRef


values As Object = 0, Optional ByRef TCWidth As Integer = 100)
As Object

questions


1. <description>
2. /FORMAT: ()
3. <Number of positions after decimal point>; ()
4. <Mini. entry value >; ()
5. <Max. entry value>; ()
6. <Error message> ()



1 100
1 100 :

1. 1 100 :
2. /FORMAT:
3. 2;
4. 1;
5. 100;
6.

www.zuken.com/e3 50
Values


value(1) = "Text"

:
1.

value(7)="32;64;128"

2.

(
)

value(2)="INPUT;-3;2,5;10"

3.
FILE:

value(5)="FILE:combo.txt"

: YESNO
TRUE
;

value(6)="YESNO:TRUE"

www.zuken.com/e3 51
TCWidth

Answ
CancelNothing

www.zuken.com/e3 52
13 E3.Tools.TableToSheetGenerator
TableToSheetGenerator, E3

13.1

E3Application (Object)
E3Application .

IgnoreEmptyRows (Boolean) (default=False)


True .

FirstSheetName (Integer (default=1))


SheetNameFormat (String (default=#))


.

KeepTablesTogether (Boolean (default=False))




TargetSheetID (Integer (default=0))


.

FillOutputArea (Boolean (default=False))



www.zuken.com/e3 53
13.2

Sub SetSheetData(ByVal sheetFormat As String, _


ByVal startX As Object, _
ByVal startY As Object, _
ByVal height As Object, _
Optional ByVal verticalAlignment As
Sheet.VerticalAlignment = 1)

:
sheetFormat: .
startX:.

startYheight

startY:

startXheight

height:

startXstartY
verticalAllignment: .:
top: 1 (default)
bottom: 2
center: 3

Sub SetSheetData2(ByVal sheetFormat As String, _


ByVal startX As Object, _
ByVal startY As Object, _
ByVal height As Object, _
Optional ByVal verticalAlignment As
Sheet.VerticalAlignment = 1)

.SetSheetData
SetSheetData2

: SetSheetData

www.zuken.com/e3 54
Sub SetTableHeaderData(ByVal symbolName As String, _
Optional ByVal level As Integer = 0, _
Optional ByVal data As Object = Nothing)

:
symbolName: .
level: /.
data: . 13 .

Sub SetTableFooterData(ByVal symbolName As String, _


Optional ByVal level As Integer = 0, _
Optional ByVal data As Object = Nothing)

:
symbolName: .
level: /.
data: . 13 .

Sub SetTableDataSymbol(ByVal symbolName As String, _


Optional ByVal level As Integer = 0)

Parameter:
symbolName: .
level: /.

www.zuken.com/e3 55
Sub SetListHeaderSymbol(ByVal symbolName As String, _
Optional ByVal data As Object = Nothing)

:
symbolName: .
data: . 13
.

Sub SetListFooterSymbol(ByVal symbolName As String, _


Optional ByVal data As Object = Nothing)

:
symbolName: .
data: . 13
.

Function NewTable(Optional ByVal spaceBeforeTable As Table.TableSpace =


0, Optional ByVal spaceAfterTable As Table.TableSpace = 0) As Boolean

(AddDataRow)./.

:
spaceBeforeTable: . -1
. -2
.
spaceAfterTable: . -1
. -2
.

:
True:
False:

www.zuken.com/e3 56
Function AddDataRow(ByVal data As Object, ByVal level As Integer = 0)
As Boolean

. 13
SetTableDataSymbol.

:
data: .
13 .
level: ..

:
True:
False:

Function ClearDataRows() As Integer

:
.

Function GetSheetCount() As Integer

:
.

Function GenerateTable(Optional ByVal sheetIds As Object = Nothing) As


Object

E3.series ..

:
sheetIds: E3.series ,,.
.
.

:
.

www.zuken.com/e3 57
Function DeleteExistingTables(ByVal sheetIds As Object) As Integer

.SetTableHeaderData,
SetTableDataSymbol,.

:
sheetIds: ,.

:
.

Function NewCell() As Object

Returns a cell.
Public Text As String
Public HyperLink As String
.
E3Text.SetHyperlinkAddress(Str).

:
Cell-Objekt.

13.3

HEADER
DATA ROW
DATA ROW
FOOTER

HEADER (Level=0)
DATA ROW (Level=0)
DATA ROW (Level=0)
HEADER (Level=1)
DATA ROW (Level=1)
DATA ROW (Level=1)
FOOTER (Level=1)
FOOTER (Level=0)

www.zuken.com/e3 58
13.4

, ,.

Error number Error text


-1 E3.Application !
'E3Application' E3.Application !
-2 !
'SetSheetData' !
-3 !
'SetTableDataSymbol' .
-4 !
'AddDataRow'!
-5 '<LEVEL>' !
-6 '<SYMBOLNAME>' '<SYMBOLVERSION>' !
-7 '<SYMBOLNAME>' '1' x='<X-POSITION>'
y='<Y-POSITION>'!
-8 (#13)
('<SYMBOLNAME>').

www.zuken.com/e3 59
14 E3.Tools.ScriptControl
ScriptControl , VBS .

14.1

14.1.1 AddObject
: .

Public Sub AddObject(ByVal name As String, ByRef obj As Object)

name: .

obj: .

14.1.2 Run
.

Public Function Run() As Boolean

True,
False

14.1.3 Reset
the ScriptControl .

Public Sub Reset()

14.2

14.2.1 Language
. JSCRIPT VBSCRIPT. VBSCRIPT.

Public Property Language() As String

www.zuken.com/e3 60
14.2.2 ScriptFullName
ScriptControl VBS script .

Public Property ScriptFullName() As String

14.2.3 Error
,.

Public ReadOnly Property [Error]() As ScriptControlError

Description:
.

Public ReadOnly Property Description() As String

Source:
.

Public ReadOnly Property Source() As String

LineNumber:
.

Public ReadOnly Property Source() As String

Code:
.

Public ReadOnly Property Code() As Short

Function Show()
.

Public Sub Show()

www.zuken.com/e3 61
14.3
C:\test.vbs VBS script.
e3, job WScript AddObjects .
Dim e3, job, script
Set script = CreateObject("E3.Tools.ScriptControl")
Set e3 = CreateObject("CT.application")
Set job = e3.createjobobject
script.ScriptFullName = "C:\test.vbs"
script.Language = "VBScript"
script.AddObject "e3",e3
script.AddObject "job", job
script.AddObject "wscript", wscript

If script.Run = False Then


Dim errMsg
errMsg = script.Error.Description & vbCrLf
errMsg = errMsg & "Src: " & script.Error.Source & vbCrLf
errMsg = errMsg & "Line: " & script.Error.LineNumber & vbCrLf
errMsg = errMsg & "Error: " & CStr(script.Error.Code)
MsgBox errMsg
'oder
script.Error.Show()
End If

script.Reset

www.zuken.com/e3 62
15 E3.Tools.AssemblyInfos
E3.Tools .

15.1

15.1.1 AssemblyPath
Public ReadOnly Property AssemblyPath() as String
DLL .

15.1.2 AssemblyVersion
Public ReadOnly Property AssemblyVersion() As Strin
DLL .

15.1.3 AssemblyName
Public ReadOnly Property AssemblyName() As String
assembly .

15.2

15.2.1 CompareVersion
: .

Public Function CompareVersion(ByVal Version As String) As Integer

:
Version:. "Major.Minor.Build"
(e.g. "2.5.7").

:
>
= 1
=
= 0
<
= -1

= -2

www.zuken.com/e3 63
15.3 Example
Dim Version
Set Version = CreateObject("E3.Tools.AssemblyInfos")
Msgbox Version.AssemblyPath
Msgbox Version.AssemblyVersion
Msgbox Version.AssemblyName

www.zuken.com/e3 64
Europe
Germany
Zuken GmbH (European HQ)
D-85399 Hallbergmoos, Germany
Tel: +49 89 607969 00

Zuken E3 GmbH
Americas D-89079 Ulm, Germany
North America Tel: +49 7305 9309 0
Zuken USA Inc.
Westford, MA 01886, USA Zuken E3 GmbH
Tel: +1 978 692 4900 D-30659 Hannover, Germany
Tel: +49 511 8595 9489

Asia Switzerland
Japan Zuken E3 GmbH
Zuken (World Wide Head Office) CH-5430 Wettingen, Switzerland
Yokohama, Kanagawa 224-8585, Japan Tel: +49 511 4370 890
Tel: +81 45 942 1511
United Kingdom
China Zuken UK Ltd.
Zuken (Beijing Representative Office) Bristol, BS32 4RF, UK
ChaoYang District, Beijing, China, 100027 Tel: +44 1454 207 801
Tel: +86 10 8447 5076
France
Korea Zuken S.A.
Zuken Korea Inc. #91974 Les Ulis Cdex, France
Seoul 135-283, Korea Tel: +33 1 69 29 48 00
Tel: +82 2 5648031
Italy
Singapur Zuken S.r.l.
Zuken Singapore Pte Ltd. 20090 Milanofiori Assago, Milan, Italy
#22-05 Gateway East, Singapore 189721 Tel: +39 02 575 921
Tel: +65 6392 5855
Netherlands
Taiwan Zuken B.V.
Zuken Taiwan Inc. NL-6002 EE Weert, The Netherlands
Taipei 110, Taiwan Tel: +31 495 583 377
Tel: +886 2 7718 1116

www.zuken.com/e3
All trademarks mentioned are the property of their respective owners, Copyright Zuken GmbH 2010
Version March 2010