API in Visual Basic 6 working fine!

Olá,

Being ocorreno this error on the line below:
erro.png
erro2.png
Thanks in advance!

I solved the problem:

Open your project.
Click the Project menu item, then select References
From Available References, check the box next to Microsoft VBScript Regular Expressions 5.5, where n.n is one of the following:

Obrigado!!!

I’m new and I’m learning with this API. Wanted to know what command to add, modify and remove a user on mikrotik.

Thank you!

My examples via SSH/New Terminal:

modify

/ip hotspot user set [/ip hotspot user find name=celular] profile=Debito

remove

/ip hotspot user remove [/ip hotspot user find address=200.189.23.202]

register / add

/ip hotspot user
add server=hotspot name=celular password=celular address=200.189.23.202 \
mac-address=bc:85:1f:d6:ac:3e profile=1024k disabled=no comment="EDILSON SOUZA - CELULAR, 3371-5090"

How is the command via API?

This system registers over a command line?

Thank you!

Hello friends. I have a question. anyone knows how to connect an api in VB a MikroTik by mac and not by ip?

API works only over TCP, it’s not possible to use API over MAC connection

thanks, i have other concerns, how i can transfer files to routeros by api?

You cannot. RouterOS API still has 4kbytes limit on file size :slight_smile:
Use ftp or scp for file transfer.

Show how active users in datagrid

How is the load profile in the list

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
    If bErr Then Exit Sub
    Dim ar() As Byte, i&
    ReDim ar(0 To bytesTotal - 1)
    ws.GetData ar, vbByte, bytesTotal
    On Error Resume Next
    Err.Clear
    On Error GoTo 0
    inbuf1 = ar
    Dim WordLen&, StartIdx&, Idx&
    StartIdx = 0
    Do While True
        Idx = StartIdx
        WordLen = CalcWordLen(inbuf1, Idx)
        If WordLen < 0 Then
            Exit Do
        End If
        If WordLen = 0 Then
            SentenceArrived (inbuf2)
            inbuf2 = ""
        Else
            If inbuf1(Idx) = Asc("=") Then
                inbuf2 = inbuf2 & " "
            End If
            For i = 0 To WordLen - 1
                inbuf2 = inbuf2 & Chr(inbuf1(Idx + i))
            Next
        End If
        StartIdx = Idx + WordLen
    Loop
End Sub

hi, i new member, thank for this script, but for me this one can’t solve my problem.. :frowning:, i try this work if i make a few users, but this not work for many users, i use v6.33 with 845 users. I can see the same results too, i find trouble like this :

  1. normal - use a few user with user manager

,
2. trouble line

i guess this trouble in data arrival

send command script :

/tool/user-manager/user/print

sorry my english not good …
thanks for help ..

with user manager (userman)

SendCommand "/tool/user-manager/profile/print"

or with internal hotspot

SendCommand "/ip/hotspot/profile/print"

why command not work
i want to disable hotspot1 by vb6

ip/hotspot/set O =name=hotspot1 O =disabled=yes

thank you

Maybe, it should be “/ip/hotspot/set”, not “ip/hotspot/set”?

Good day everyone.

Is it still working with routerOs firmware version 6.46.3. I got an error invalid username or password.

Anyone have update script for VB6 how to get login?

Thank in advance.
error MK API VB 6.PNG

I already log in now, after read a topic here http://forum.mikrotik.com/t/how-vb-api-disable-hotspot/120556/1

Change this line:

tmp = "/login =name=" & txtUser.text & " =response=00" & tmp

Into this:

tmp = "/login =name=" & txtUser.text & " =password=" & txtPass.text

Thank you.

how organize in a datagrid or any where

I missing winsock, are you have the link it?