Hi all of you,
I use, at work, an IBM 3270 mainframe emulator : myExtra! from Attachmate.
I want to use AHK_L to manage it. There is a COM interface in myExtra! that I (want to) use to get informations and to send commands. Before I used WS4AHK and (sorry erictheturtle) I want to go to AHK_L.
When I want to get information, it seems to work (even if the call need parameters).
But when I want to set informations and, for example, to send commands/keystrokes to the emulator, it fails.
I use what I done under WS4AHK (that works) and I try to translate it to make it work under AHK_L. I took :
Code:
WS_CursSend(WS_SC_Line, WS_SC_Col, WS_SC_TypeOfSend = 0, WS_SC_ToTransf = "", WS_SC_Ent = 0, WS_SC_Home = 0, WS_SC_Tab = 0)
Put the cursor at WS_SC_Line, WS_SC_Col in the screen.
Eventually send a string with SendKeys or Paste.
Eventually send enter at the end.
*/
WS_CursSend(WS_SC_Line, WS_SC_Col, WS_SC_TypeOfSend = 0, WS_SC_ToTransf = "", WS_SC_Ent = 0)
{
Tabul := "<Tab>"
Enter := "<Enter>"
Start := "<Home>"
Global FEN_P_XT ; Name of the window
If !WinExist(FEN_P_XT)
Return -4
Else
{
ScrPos := VBStr(WS_SC_Line) . ", " . VBStr(WS_SC_Col)
WS_Initialize()
WS_Exec("Set Sys = CreateObject(""EXTRA.System"")")
WS_Exec("Set Sess = Sys.ActiveSession")
WS_Exec("Set MyScreen = Sess.Screen")
If (WS_SC_Line and WS_SC_Col)
WS_Exec("MyScreen.MoveTo" . ScrPos)
If (WS_SC_TypeOfSend = 1 and WS_SC_ToTransf <> "")
WS_Exec("MyScreen.SendKeys" . VBStr(WS_SC_ToTransf))
If (WS_SC_TypeOfSend = 2 and WS_SC_ToTransf <> "")
WS_Exec("MyScreen.Paste")
If WS_SC_Ent
WS_Exec("MyScreen.SendKeys" . VBStr(Enter))
WS_Exec("Set Sys = Nothing")
WS_Exec("Set Sess = Nothing")
WS_Exec("Set MyScreen = Nothing")
WS_Uninitialize()
Return True
}
}
But to send something to MyExtra! with AHK_L, I can't succeed, I get errors (they are commented) :
Code:
^F6::
a := AhkLCOM_mE_CursSend(23, 16, 1, "ctrep david", 1 )
AhkLCOM_mE_CursSend(AhkLCOM_mE_SC_Line, AhkLCOM_mE_SC_Col, AhkLCOM_mE_SC_TypeOfSend = 0, AhkLCOM_mE_SC_ToTransf = "", AhkLCOM_mE_SC_Ent = 0)
{
Tabul := "<Tab>"
Enter := "<Enter>"
Start := "<Home>"
Global FEN_P_XT
If !omE := ComObjCreate("EXTRA.System")
Return -4
omE := omE.ActiveSession
omE := omE.Screen
ScrPos := AhkLCOM_mE_SC_Line . ", " . AhkLCOM_mE_SC_Col
If (AhkLCOM_mE_SC_Line and AhkLCOM_mE_SC_Col)
; Here are the try I did with the MoveTo Method :
; omE.MoveTo[ScrPos] ; Error : Non optionnal parameter
; omE.MoveTo(ScrPos) ; Error : Non optionnal parameter
; omE.MoveTo[AhkLCOM_mE_SC_Line, AhkLCOM_mE_SC_Col] ; Error : Type isn't corresponding
; omE.MoveTo(AhkLCOM_mE_SC_Line, AhkLCOM_mE_SC_Col) ; Error : Type isn't corresponding
; omE.MoveTo[ScrPos] := Result ; Error : Type isn't corresponding
; result := omE.MoveTo[ScrPos] ; Error : Type isn't corresponding
; result := omE.MoveTo(ScrPos) ; Error : Type isn't corresponding
If (AhkLCOM_mE_SC_TypeOfSend = 1 and AhkLCOM_mE_SC_ToTransf <> "")
omE.SendKeys := AhkLCOM_mE_SC_ToTransf
If (AhkLCOM_mE_SC_TypeOfSend = 2 and AhkLCOM_mE_SC_ToTransf <> "")
omE.Paste
If AhkLCOM_mE_SC_Ent
omE.SendKeys := Enter
; omE.SendKeys[Enter]
; omE.SendKeys(Enter)
omE := ""
Return True
}
myExtra! help wrote:
MoveTo Method
Applies To Objects
Screen
Description
Moves the cursor to the specified location.
Certain VT hosts do not allow arbitrary cursor positioning, in which case this method will have no effect.
Syntax
object.MoveTo Row, Col [, Page]
Element Description
object The Screen object.
Row The row location.
Col The column location.
Page (optional) The page location.
Comments
To move the cursor to a position relative to its current one, use the MoveRelative method.
MoveTo Method Example
The example moves the cursor to a random row, column and page on the screen.
Sub Main()
Dim Sys As Object, Sess As Object, MyScreen As Object
Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
Set Sess = Sys.ActiveSession
Set MyScreen = Sess.Screen
For i = 1 to 10
Randomize
NewRow = Int(MyScreen.Rows*Rnd())+1
NewCol = Int(MyScreen.Cols*Rnd())+1
NewPage = Int(MyScreen.Pages*Rnd())+1
MsgBox "Move to " + Str$(NewRow) + "," + Str$(NewCol) + "."
MyScreen.MoveTo NewRow,NewCol,NewPage
Next
End Sub
Copyright 1996 - 2001, Attachmate Corporation. All rights reserved.
The errors are "Non optionnal parameter" or "The type isn't corresponding".
I don't know what does they means. I don't know how to send commands to the emulator. May be my syntax to set with AHK_L is not the good one.
Any ideas ?
I thank you in advance and sorry for the length of the message, but I suppose that note all of you knows the myExtra! VB...