---
rexxpub:
  defaults: rony.yaml
  logo: oorexx
---

<!-- 140_AutoWin_vba_V03.odp (2026-10-15 09:40) -->

<!-- slide # 1 (2026-10-15 09:40) ----------------------------- ODP slide # 1 -->
. slide cover
# Windows-Automatisation 4

. subtitle
**Object Rexx (“ooRexx”) vs. MS Visual Basic Script ("VBScript")**

. cover-art
. picture img/140_AutoWin_vba_V03/p01-diagram-7.png

<!-- slide # 2 (2026-10-15 09:40) ----------------------------- ODP slide # 2 -->
# MS Visual BASIC (Script/Application) ….

. steps each=after
- Extremely popular on Windows for OLE programming
. click
- Different closely related versions
    - **VBS** a.k.a. **VBScript** (Visual BASIC script)
    - **VBA** (Visual BASIC for Applications)
. click
- Searching the Internet with the keywords "*vba ole someApp/Method*"
    - Usually yields many hits with **VBScript**/**VBA** code snippets
    - Therefore important to know how to translate **VBScript**/**VBA** \<---\> **ooRexx**
. click
- A comment on **VB.NET**
    - Visual BASIC for **.NET**
    - Resembles **VBScript** and **VBA**, but is not compatible

<!-- slide # 3 (2026-10-15 09:40) ----------------------------- ODP slide # 3 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

- [Message operator]{.fragment .afterPrevious}\
  `~` (Tilde)
- [Continuation character]{.fragment}\
  `,` (comma) or `–` (dash)
- [String concatenation]{.fragment}\
  (space between strings)\
  `||` (2 vertical bars)\

  . with picture img/140_AutoWin_vba_V03/p03-diagram-8.png width=5%

  [*var1***"some string"***var2* (abuttal)]{.fragment .withPrevious}
- [Defining variables]{.fragment}\
  Just denote the name in an assignment


. next column

[**VBScript**]{.fragment .withPrevious}

- ["Message" (dereference) operator]{.fragment .withPrevious}\
  `.` (dot)
- [Continuation character]{.fragment .withPrevious}\
  `_` (underline)
- [String concatenation]{.fragment .withPrevious}\
  `&` (ampersand)
- [Defining variables]{.fragment .withPrevious}\
  `DIM` var\_names

. end columns

<!-- slide # 4 (2026-10-15 09:40) ----------------------------- ODP slide # 4 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

- [Line comment]{.fragment .afterPrevious}\
  `--` (2 dashes)
. click
- Block (multi-line) comments

  . with
  ```rexx
  /* ... */
  ```

    - May span multiple lines
    - May be nested


. next column

[**VBScript**]{.fragment .withPrevious}

- [Line comment]{.fragment .withPrevious}\
  `' (`apostroph)

  . with
  ```rexx
  REM
  ```

    - Abbreviation for REMark
    - No statement before it allowed

      . with
      ```
      : REM
      ```

    - If following a statement in the same line, must be preceeded by a column surrounded by a space

. end columns

<!-- slide # 5 (2026-10-15 09:40) ----------------------------- ODP slide # 5 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

. after
- Calling a procedure

  . with
  ```rexx
  CALL proc1 a1, a2, a3
  ```

. click
- Calling a function

  . with
  ```rexx
  a=proc1(a1, a2, a3)
  ```

  [or:]{.fragment .afterPrevious}

  . with
  ```rexx
  CALL proc1 a1, a2, a3
  a=result
  ```


. next column

[**VBScript**]{.fragment .withPrevious}

. with
- Calling a procedure

  [**CALL proc1(a1, a2, a3)**]{.fragment .withPrevious}

  [or:]{.fragment .afterPrevious}

  . click
  ```rexx
  proc1 a1, a2, a3
  ```

. with
- Calling a function

  . with
  ```rexx
  a=proc1(a1, a2, a3)
  ```

. end columns

<!-- slide # 6 (2026-10-15 09:40) ----------------------------- ODP slide # 6 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

. after
- Calling a function

  . with
  ```rexx
  a=proc1( , , a3)
  ```

  [or:]{.fragment .afterPrevious}

  . with
  ```rexx
  CALL proc1 , , a3
  a=result
  ```


. next column

[**VBScript**]{.fragment .withPrevious}

. with
- Calling a function

  . mark id=#a1 1 "a3" box pen=red
  . with id=#v1
  ```rexx
  a=proc1(  ,   , a3)
  ```

. click
- Calling a function using named arguments, e.g.

  . mark id=#a2 1 "a3" box pen=red
  . with id=#v2
  ```
  a=proc1( a3 := "Das 3. Argument!" )
  ```

  . click show #a1 #a2
  . with arrow #v1:1:"a3" -> #v2:1:"a3"

. end columns

<!-- slide # 7 (2026-10-15 09:40) ----------------------------- ODP slide # 7 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

. after
- Defining a procedure

  . with
  ```rexx
  proc1: procedure
    use arg a1, a2, a3
    say "a1="a1 "a2="a2 "a3="a3
    return
  ```

  [or:]{.fragment .afterPrevious}

  . with
  ```rexx
  ::routine proc1
    use arg a1, a2, a3
    say "a1="a1 "a2="a2 "a3="a3
  ```


. next column

[**VBScript**]{.fragment .withPrevious}

. with
- Defining a procedure

  . with
  ```monobasic
  Sub proc1(a1, a2, a3)
     MsgBox "a1=" & a1 & " a2=" & a2 _
            " a3=" & a3
  End Sub
  ```

. end columns

<!-- slide # 8 (2026-10-15 09:40) ----------------------------- ODP slide # 8 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

. after
- Defining a function

  . with
  ```rexx
  proc1: procedure
    use arg a1, a2, a3
    return a1 || a2 || a3
  ```

  [or:]{.fragment}

  . with
  ```rexx
  ::routine proc1
    use arg a1, a2, a3
    return a1 || a2 || a3
  ```


. next column

[**VBScript**]{.fragment .withPrevious}

. with
- Defining a function

  . with
  ```
  Func proc1(a1, a2, a3)
     proc1=a1 & a2 & a3
  End Func
  ```

. end columns

<!-- slide # 9 (2026-10-15 09:40) ----------------------------- ODP slide # 9 -->
# ooRexx vs. VBScript

. columns 6 6 ruled

[**ooRexx**]{.fragment .afterPrevious}

. click
- Address structure/object:

  . with
  ```rexx
  MyLabel~Height  = 2000
  MyLabel~Width   = 2000
  MyLabel~Caption = "This is MyLabel"
  ```

. click
- or (to save a little bit of typing):

  . with
  ```rexx
  m=MyLabel
  m~Height  = 2000
  m~Width   = 2000
  m~Caption = "This is MyLabel"
  ```


. next column

[**VBScript**]{.fragment .withPrevious}

. with
- Address structure/object: WITH statement

  . with
  ```
  With MyLabel
     .Height  = 2000
     .Width   = 2000
     .Caption = "This is MyLabel"
  End With
  ```

. click
- without WITH statement

  . with
  ```rexx
  MyLabel.Height  = 2000
  MyLabel.Width   = 2000
  MyLabel.Caption = "This is MyLabel"
  ```

. end columns

<!-- slide # 10 (2026-10-15 09:40) --------------------------- ODP slide # 10 -->
# ooRexx vs. VBScript

. after
```monobasic
' VBScript: "counter.vbs"
dim MyVar
Set MyVar = createObject("Some.Counter")
wscript.echo "Counter: " & MyVar.counter
call wscript.echo( "Counter: " & MyVar.increment )
```

. after
```rexx
-- REXX: "counter.rex"
MyVar = .OLEObject~new("Some.Counter")
wscript~echo( "Counter:" MyVar~counter )
wscript~echo( "Counter:" MyVar~increment )
```

<!-- slide # 11 (2026-10-15 09:40) ----------- business card (not in the ODP) -->
. slide card logo=none
# Contact