Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moveto and putstring wont work?

Status
Not open for further replies.

worz

Programmer
Jun 27, 2003
8
GB
Hi guys,

I am using Attachmate my EXTRA Enterprise 7.11

and the MoveTo and Putstring will not work. They just dont move or put :p

Getstring works fine so I know I am using the right co=ords etc?
Any ideas? My screen does have lots of protected fields but obviously i am not trying to put data there.

Cheers

Worz
 


Hi,

Please post the code that is not working. If you are using variables, please describe the exact values used for the displayed results on the screen.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I have attached a bit of the code, most of which is cribbed from these forums. However my problem is literally the moveto command doesnt move to the coords it should, it seems to be dependent on where abouts the cursor is on the screen when I run the code.

So when I run this code with the cursor at 4,9 it pastes "xxx" to 1 "x" at 18,78 and the other 2 "xx" at 20,15and 16
If I run from a different cursor position it will go somewhere else, as if i was using moverelevent. Even so there seems to be no real pattern.

Regards
Worz

Sub test()

Dim MyRange As Range
Dim xlSheet As Worksheet
Dim System As ExtraSystem
Dim Sess0 As ExtraSession
Dim oScrn As ExtraScreen
Dim examplextn As String

Set System = CreateObject("Extra.system")

g_HostSettleTime = 800

OldSystemTimeout& = System.TimeoutValue

If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

If (System Is Nothing) Then
MsgBox "Could not Create Session"
Stop
End If

Set Sess0 = System.Activesession
Set oScrn = Sess0.Screen
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

Application.Visible = True
Application.DisplayAlerts = False 'Turn off Warning Messages

Set xlSheet = ActiveSheet

examplextn = xlSheet.Range("H1")



oScrn.MoveTo 13, 50
oScrn.PutString "XXX"

End Sub
 




oScrn.MoveTo 13, 50
oScrn.PutString "XXX", 13, 50


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


I think he's running in Excel VAB and not in Extra. Otherwise, he would have to Create an Excel Object.

But maybe THAT's the problem.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Yes I am running it in VBA.

Skip when I change from

oScrn.MoveTo 13, 50
oScrn.PutString "XXX"

to
oScrn.PutString "XXX", 13, 50

That doesnt work either, with the first option it moves to a position (not the correct one) and pastes xxx
With the second option it just pastes xxx wherever the cursor happens to be.

What I think is that my Attachmate my EXTRA Enterprise 7.11
doesn not allow me to move around the screen for some reason. But I dont know why....

Worz


 
i still don't see how you got your code to compile
but here's my code
Code:
Sub test2()
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
Set oScrn = Sess0.Screen
oScrn.MoveTo 13, 50
oScrn.PutString "XXX"
End Sub
 
[SAMPLE CODE WORKS WELL]

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Sess0.EditScheme = "Character"
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

' This section of code contains the recorded events

Sess0.Screen.Putstring ("1208") 08,04
Sess0.Screen.Putstring ("rev") 08,53
Sess0.Screen.Sendkeys("<ENTER>")
Do While sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Putstring ("r") 10,02
Sess0.Screen.Sendkeys("<ENTER>")
Do While sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
Sess0.Screen.Putstring ("REV") 21,06
Sess0.Screen.Putstring ("DE") 21,10
Sess0.Screen.Sendkeys("<ENTER>")
Do While sess0.Screen.OIA.Xstatus <> 0
DoEvents
Loop
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Putstring ("Y") 08,20
Sess0.Screen.Putstring ("Y") 13,66
Sess0.Screen.Sendkeys("<ENTER>")

System.TimeoutValue = OldSystemTimeout
End Sub
 
Guys, thanks for all your ideas, however none of them work for me.
They all have the same problem as I did at the start in that the moveto and putstrings just dont move.
As I said in my first post i think it must be something to do with my set up of Attachmate not with the code I was trying to use.


 
is there a chance that some piece of code is locking your extra session before the MoveTo line even has a chance to execute. Sometimes in our sessions, if you try to put info outside of an accepted field, the screen will lock, and the user must depress the escape key to unlock it.

Additionally, if you are sending keystrokes like 'rev' and that stuff, use the SendKeys Command as in
Code:
Sess0.Screen.MoveTo 7, 15
Sess0.Screen.SendKeys ("REV")
if you are actually putting data that has been stored in to a variable in to the session you need to do something like this
Code:
Dim toExtra as String
toExtra = "REV"
Sess0.Screen.MoveTo 7, 15
Sess0.Screen.PutString (toExtra)
additionally, it you hate the MoveTo command or have been having issues, try
Code:
Sess0.Screen.PutString (toExtra), 7, 15
please let us know if this helps at all or if you are still having issues

this was all stuff that was coded in Excel VBA so it should work fine
 
thanks for trying obfuscate

however it is not the code I am using. I am convinced it is the way the Extra screen is set up, the fact that you cant type in every cell maybe?

I have tried every piece of code that has been offered and none work :(

I have given up and am having to <TAB> around the screen, checking cursor position as I go.
 
worz,

Are you sure that the sintax code is correct?
You're defining variables as
...
Dim System As ExtraSystem
Dim Sess0 As ExtraSession
Dim oScrn As ExtraScreen
...
You could use
Dim System As Object
Dim Sess0 As Object
Dim oScrn As Object
...
Other point to look is the sintax of Putstring in VBA
instead of
...
Sess0.Screen.Putstring ("Y") 08,20
Sess0.Screen.Sendkeys("<ENTER>")
...
You should use
Sess0.Screen.Putstring "Y",08,20
Sess0.Screen.Sendkeys "<ENTER>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top