×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Put string not copying the exact variable

Put string not copying the exact variable

Put string not copying the exact variable

(OP)
thread1-1582572: moveto and putstring wont work?

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

RE: Put string not copying the exact variable

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

RE: Put string not copying the exact variable

(OP)
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

RE: Put string not copying the exact variable

what if you use sendkeys instead of putstring?

RE: Put string not copying the exact variable

(OP)
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?

RE: Put string not copying the exact variable

(OP)
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$

RE: Put string not copying the exact variable

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

RE: Put string not copying the exact variable

(OP)
Hi Lakare,

I cant even compile it.

Thanks,

Jonats

RE: Put string not copying the exact variable

Jonats,

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

RE: Put string not copying the exact variable

(OP)
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

RE: Put string not copying the exact variable

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

RE: Put string not copying the exact variable

(OP)
Thanks Lakare. I tried it but it doesnt work; i even need to reboot my pc to work normal again:)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close