AI Object
 
The simplest use of the AI Object: ask a question, wait for the answer, show it.
 
 
Option Explicit
 
Sub Main
    Dim aiHnd As Long
 
    aiHnd = AI.Ask("Give a short explanation of the term 'credit limit'.")
    If aiHnd = 0 Then
        MsgBox "Submit failed: " & AI.LastErrorMessage, vbCritical
        Exit Sub
    End If
 
    Do
        DoEvents
    Loop Until AI.GetStatus(aiHnd) <> 1     ' 1 = aiStatusBusy
 
    If AI.GetStatus(aiHnd) = 2 Then           ' 2 = aiStatusReady
        MsgBox AI.GetResultStr(aiHnd), vbInformation, "AI answer"
    Else
        MsgBox "Error: " & AI.GetErrorMessage(aiHnd), vbCritical
    End If
 
    AI.CloseHandle aiHnd
End Sub
 
 
See Also
AskGetStatusGetResultStrCloseHandle.