Translate VBA to B4J

DonManfred

Expert
Licensed User
Longtime User
I do not know VBA but anyway: How could one answer your question WITHOUT knowing what you need to get "translated"?
What does the VBA Code do? Post it
 

Ilya G.

Active Member
Licensed User
Longtime User
It is to control some devices through rs-485
 

Attachments

  • vba.zip
    7.9 KB · Views: 280

JohnC

Expert
Licensed User
Longtime User
Is it possible you could resave the txt files in a different [Unicode] format because most of the characters are not legible:

Dim vh As Byte 'ñåðèéíûé íîìåð êîíòðîëëåðà
 

Ilya G.

Active Member
Licensed User
Longtime User
Is it possible you could resave the txt files in a different [Unicode] format because most of the characters are not legible:

Dim vh As Byte 'ñåðèéíûé íîìåð êîíòðîëëåðà
there are comments in russian :)
 

Attachments

  • SKUD.zip
    8.5 KB · Views: 218

JohnC

Expert
Licensed User
Longtime User
Ah, I don't have the Russian language pack installed, so that explains why.

VBA is a form of basic for Microsoft applications like Access, Excel and Word which allows users to create custom scripts to get those office applications to do/automate special things that they normally don't do.

The code is definitely doing a lot of serial communication and bit manipulation, but without English translation for every line, it would take a lot of time to understand the overall picture of what the code does.
 
Last edited:

Ilya G.

Active Member
Licensed User
Longtime User
I think it's VB, not VBA. I will try to translate comments to english in google translate
 

JohnC

Expert
Licensed User
Longtime User
It is to control some devices through rs-485
VB still runs on Windows 10 PC's, so can I ask why you want to change platforms?
 

roerGarcia

Active Member
Licensed User
Longtime User
This is very specific, do you have the operation manual for that equipment?

Rich (BB code):
Public Function tstKv () As String
'we convert the string and check the type of converter, if it is Z397-Guard then return its operating mode
Dim stro As String 'formed string
Dim i as byte
Dim rr as string

i = 0
'prepare a message


 Do While i <pssl
 stro = stro + Chr (m5 (i)) 'convert to symbol
 i = i + 1
 Loop
'MsgBox Trim (stro)
'MsgBox Mid (Trim (stro), 1, 10)
If Mid (Trim (stro), 1, 10) = "Z397-Guard" Then
    rr = Mid (Trim (stro), 27, 1)
Else: rr = 8
Call CloseHandle (ss)
End if
 

Ilya G.

Active Member
Licensed User
Longtime User
This is very specific, do you have the operation manual for that equipment?

Rich (BB code):
Public Function tstKv () As String
'we convert the string and check the type of converter, if it is Z397-Guard then return its operating mode
Dim stro As String 'formed string
Dim i as byte
Dim rr as string

i = 0
'prepare a message


Do While i <pssl
stro = stro + Chr (m5 (i)) 'convert to symbol
i = i + 1
Loop
'MsgBox Trim (stro)
'MsgBox Mid (Trim (stro), 1, 10)
If Mid (Trim (stro), 1, 10) = "Z397-Guard" Then
    rr = Mid (Trim (stro), 27, 1)
Else: rr = 8
Call CloseHandle (ss)
End if
You mean you need Mid (Trim (stro), 27, 1)?
 

JohnC

Expert
Licensed User
Longtime User
You mean you need Mid (Trim (stro), 27, 1)?
I think he means that these routines are communicating with the device using a very specific protocol. And hopefully the operation manual will describe this protocol in detail so we can better understand the command set and handshaking requirements to communicate with the device.
 

Ilya G.

Active Member
Licensed User
Longtime User
Documentation is available, but in Russian https://ironlogic.ru/il_new.nsf/htm/ru_advanced_protokol & http://posix.ironlogic.ru/wiki/Z397....B2.D0.B5.D1.80.D1.82.D0.B5.D1.80.D0.BE.D0.BC

This is very specific, do you have the operation manual for that equipment?

Rich (BB code):
Public Function tstKv () As String
'we convert the string and check the type of converter, if it is Z397-Guard then return its operating mode
Dim stro As String 'formed string
Dim i as byte
Dim rr as string

i = 0
'prepare a message


Do While i <pssl
stro = stro + Chr (m5 (i)) 'convert to symbol
i = i + 1
Loop
'MsgBox Trim (stro)
'MsgBox Mid (Trim (stro), 1, 10)
If Mid (Trim (stro), 1, 10) = "Z397-Guard" Then
    rr = Mid (Trim (stro), 27, 1)
Else: rr = 8
Call CloseHandle (ss)
End if
This code apparently handles the response: Z397-Guard S/N:00214,Mode:0
 
Top