Hi , all ,
I´m programing a visual basic application (read from excel and capture from Accessory Manager) , is almost working , is reading and capturing information, but the problem is that , after the <transmit>, to get the result in the screen , is returnig , another screen not with the putstring data
Here is the code
Thanks
appExcel = CreateObject("Excel.Application")
wbExcel = appExcel.Workbooks.Open("d:\teste.xlsx")
appExcel.Workbooks.Open("d:\teste.xlsx")
System = CreateObject("ACCMGR.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox("Could not create the EXTRA System object. Stopping macro playback.")
Stop
End If
If (Sessions Is Nothing) Then
MsgBox("Could not create the Sessions collection object. Stopping macro playback.")
Stop
End If
g_HostSettleTime = 3000 ' milliseconds
OldSystemTimeout = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
Myscreen = System.ActiveSession
If (Myscreen Is Nothing) Then
MsgBox("Could not create the Screen object. Stopping macro playback.")
Stop
End If
If Not Myscreen.Visible Then
Myscreen.Visible = True
End If
appExcel.Worksheets("Main").Activate()
Lastrow = appExcel.Worksheets("Main").UsedRange.Rows.Count
For fila = 2 To Lastrow
Consumo = Trim(appExcel.Worksheets("Main").Cells(fila, 1).Value)
Eco_Dom = Trim(appExcel.Worksheets("Main").Cells(fila, 5).Value)
Com_Esgoto = Trim(appExcel.Worksheets("Main").Cells(fila, 17).Value)
Myscreen.screen.putstring(Consumo, 4, 39)
Myscreen.screen.putstring(Eco_Dom, 6, 39)
Myscreen.screen.putstring(Com_Esgoto, 15, 39)
Myscreen.screen.Sendkeys("<Transmit>")
Myscreen.screen.WaitHostQuiet(g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout
Saida = Myscreen.screen.getstring(20, 40, 17)
appExcel.Cells(fila, 19).Value = Saida
Next
appExcel.ActiveWorkbook.Save()
appExcel.Visible = True
appExcel.ActiveWorkbook.Close()
appExcel = Nothing
End Sub
I´m programing a visual basic application (read from excel and capture from Accessory Manager) , is almost working , is reading and capturing information, but the problem is that , after the <transmit>, to get the result in the screen , is returnig , another screen not with the putstring data
Here is the code
Thanks
appExcel = CreateObject("Excel.Application")
wbExcel = appExcel.Workbooks.Open("d:\teste.xlsx")
appExcel.Workbooks.Open("d:\teste.xlsx")
System = CreateObject("ACCMGR.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox("Could not create the EXTRA System object. Stopping macro playback.")
Stop
End If
If (Sessions Is Nothing) Then
MsgBox("Could not create the Sessions collection object. Stopping macro playback.")
Stop
End If
g_HostSettleTime = 3000 ' milliseconds
OldSystemTimeout = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
Myscreen = System.ActiveSession
If (Myscreen Is Nothing) Then
MsgBox("Could not create the Screen object. Stopping macro playback.")
Stop
End If
If Not Myscreen.Visible Then
Myscreen.Visible = True
End If
appExcel.Worksheets("Main").Activate()
Lastrow = appExcel.Worksheets("Main").UsedRange.Rows.Count
For fila = 2 To Lastrow
Consumo = Trim(appExcel.Worksheets("Main").Cells(fila, 1).Value)
Eco_Dom = Trim(appExcel.Worksheets("Main").Cells(fila, 5).Value)
Com_Esgoto = Trim(appExcel.Worksheets("Main").Cells(fila, 17).Value)
Myscreen.screen.putstring(Consumo, 4, 39)
Myscreen.screen.putstring(Eco_Dom, 6, 39)
Myscreen.screen.putstring(Com_Esgoto, 15, 39)
Myscreen.screen.Sendkeys("<Transmit>")
Myscreen.screen.WaitHostQuiet(g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout
Saida = Myscreen.screen.getstring(20, 40, 17)
appExcel.Cells(fila, 19).Value = Saida
Next
appExcel.ActiveWorkbook.Save()
appExcel.Visible = True
appExcel.ActiveWorkbook.Close()
appExcel = Nothing
End Sub