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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put string not copying the exact variable 1

Status
Not open for further replies.

jonats

Technical User
Sep 3, 2008
18
PL
thread1-1582572

Hi Guys,

This code is working fine except that "Okł" was put as "Ok-".

Dim Jonats as String
Jonats = "Okł"
Sess0.Screen.PutString (Jonats)


Can somebody please help on how to preserve special/national characters?

Thanks and Regards,
Jonathan
 
Hey,

As far as I know, it is only able to handle ASCII and ANSI, and not utf-8 characters.

Sorry, hope you can find a solution.

Lakare
 
Hi Lakare,

But msgbox is returning the correct polish characters; normal cut and paste from excel to mainframe is working fine as well.

Thanks for your reply.

Best regards,
J
 
Hi Remy,
Super! It works!
Thank you very much.
J

i have the same problem copying from
host to txt/doc file;
shall i change my "write #1, buffer$"
to something else?
 
Or maybe i need to change GetString to something
just like you did to PutString?
Buffer$ = Buffer$ & objAttachScreen.GetString(1,1, Buffersize%)
Write #1, Buffer$
 
Hey jonats

Don't know if is works, but have you tried

Code:
Dim area As Object
Set area = Sess0.Screen.Select(StartRow, StartCol, EndRow, EndCol)

Lakare
 
Hi Lakare,

I cant even compile it.

Thanks,

Jonats
 
Jonats,

are you writing to a text file?
can you show us your code? that may help us help you.

 
Hi Remy,

Yes, I am writing to a text file.
Here is the macro:

'Global Variables
Global CapBuffer As Variant
Global CapBuffSize As Long

Sub Main()

' Get the Attachmate Screen Object

Dim objAttachScreen As Object
Set objAttachScreen = CreateObject("EXTRA.System").ActiveSession.Screen

If (objAttachScreen is Nothing) Then
Msgbox "Could not create the Screen object. Possible solution open a session and try again."
STOP
End If

' Set the default wait timeout value
g_HostSettleTime = 1500 ' milliseconds

' Name the variables
Dim Columns%
Dim Rows%
Dim BufferSize As integer
Dim Buffer As String
Dim bLastPage
Dim NewBuffer As String
Dim CRLF As String
Dim CurPos As Integer

' This section of code contains the recorded events
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<PF8>")

' Determine the size of the Screen
Rows%=objAttachScreen.Rows()
Columns%=objAttachScreen.Cols()
BufferSize%= Rows% * Columns%
Buffer$ = ""
NewBuffer = ""
CRLF$=Chr$(13) + Chr$(10)
CurPos% = 1
CapBuffer = ""
CapBuffSize& = 0

Open "c:\From Old PC\host_to word.txt" For Append as #1

' Copy all report screens
Do
objAttachScreen.WaitHostQuiet(g_HostSettleTime)
Buffer$ = Buffer$ & objAttachScreen.GetString(1,1, BufferSize%)
While CurPos% < BufferSize%
NewBuffer$ = NewBuffer$ + Mid$(Buffer$, CurPos%, Columns%) + CRLF$
CurPos% = Curpos% + Columns%
Wend
CurPos% =1
Buffer$=NewBuffer$
Write #1, Buffer$
bLastPage = Instr(Buffer$,"Bottom")
NewBuffer$ = ""
Buffer$ = ""
objAttachScreen.Sendkeys("<PF8>")
' objAttachScreen.Sendkeys("<DOWN>")
Loop Until bLastPage
msgbox "finished"
'objAttachScreen.Sendkeys("<PF1>")
'objAttachScreen.Sendkeys("E")
'objAttachScreen.Sendkeys("<Ctrl+M>")
'objAttachScreen.Sendkeys("<Ctrl+M>")


Close #1
End Sub


Thanks and Regards,
Jonathan
 
Jonats,

You should be able to change,
Code:
Buffer$ = Buffer$ & objAttachScreen.GetString(1,1, BufferSize%)
with
Code:
Dim area As Object
Set area = objAttachScreen.Select(1, 1, 1, BufferSize%) 
Buffer$ = Buffer$ & area

even though its a bit more complicated.

Lakare
 
Thanks Lakare. I tried it but it doesnt work; i even need to reboot my pc to work normal again:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top