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!

Entering and Deleting values

Status
Not open for further replies.

thelastlizard

Programmer
Sep 26, 2013
8
US
I've got this code to scrub data in Excel and input it into the mainframe accordingly. I'm wondering if there's a way to use the same code&Excel worksheet to conversely delete these values - short of filling in the Excel worksheet with a horde of spacebars, is there something else I can use what will both enter and delete values? Perhaps I am limiting myself by using PutString; is there another command I can try? Thanks!


InputHeader:

Sess0.Screen.sendkeys("<pf5>")
Sess0.Screen.WaitHostQuiet(1)
Sess0.Screen.PutString vblSheet.Cells(RowX, 2),3,12
Sess0.Screen.PutString vblSheet.Cells(RowX, 1),4,11
Sess0.Screen.sendkeys("<enter>")
Sess0.Screen.WaitHostQuiet(5)
Sess0.Screen.PutString vblSheet.Cells(RowX, 3),6,17
Sess0.Screen.PutString vblSheet.Cells(RowX, 4),6,41
Sess0.Screen.PutString vblSheet.Cells(RowX, 5),6,65
Sess0.Screen.PutString vblSheet.Cells(RowX, 6),6,90
Sess0.Screen.sendkeys("<enter>")
Sess0.Screen.WaitHostQuiet(5)
 
hi,

So this is not an INQUIRY screen, it is an UPDATE screen, and hitting the ENTER key in this screen UPDATES data for this screen transaction in your mainframe?

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

Here's something to consider with respect to
Code:
Sess0.Screen.WaitHostQuiet(5)
You are working with an asynchronous process. When you Sess0.Screen.sendkeys("<enter>"), ther is no certainty when the emulator will be ready for your input. could be less than one second; count be more than a minute. YOU DON'T KNOW!

So what with Sess0.Screen.WaitHostQuiet([highlight #FCE94F]5[/highlight])??? You don't know if [highlight #FCE94F]5[/highlight] is too much time, which does not SEEM to matter or if [highlight #FCE94F]5[/highlight] is too little time, in which case your program goes ahead and enters data the the emulator is not ready to process and so IT'S LOST!

Think about it. When you drive your car, you would not even think about setting a [highlight #FCE94F]5[/highlight] second stop wait, would you? You drive up to the stop sign and STOP, wait for 5 seconds and then GO, regardless of the traffic conditions. NOOOOOOO! You wait for visual FEEDBACK. Which is what you need to do in an asynchronous screen emulator. I like to use WaitForCursor in a loop until it returns TRUE. You'll need to Screen Rest coordinated.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Hi Skip,
Yes, that's correct. We are currently using this code to input information between 4 different fields, so when the macro says <enter> the screen gets updated. Thing is...some of the information we enter becomes obsolete or expires, so we need a way of quickly removing it specific fields. Short of entering [spacebars] to clear the field, do you know of a way to delete the information with the same or a similar code, taking triggers from the Excel worksheet?

Thanks by the way, you got me again with the WaitHostQuiet - you've gotten me on that before haha, and I will be changing it...
 

You need to know the length of the field on the screen. This will "clear" a 5 byte field at 3,12
Code:
Dim FieldLen as Integer
Const SPACES = "                                             "

FieldLen = 5

Sess0.Screen.PutString mid(SPACES,1,FieldLen),3,12

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
If I am reading this correctly, it will delete/clear the data at (r,c) regardless of my Excel worksheet, right?
 


Do you see anything from your worksheet in my code?

What am I missing?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
You're right; that isn't quite what I was looking for. We would like to prep/scrub the data in Excel - to input and delete as necessary. I think we'll just have to input the information in Excel to update the screen, or key in the appropriate number of [spacebars] into Excel to delete the information later.
 
Not necessarily.

Consider building a table in Excel that describes EVERY SCREEN that you might encounter, and then a set of routines to interpret the table, based on the screen that you are processing. Your table might look something like this...
[pre]
Screen Name From Thru Col Len
ORD01 Time 1 1 60 8
ORD01 ORDER 3 3 2 10
ORD01 PART ID 3 3 14 30
ORD01 OPER 5 20 2 4
ORD01 SETUP 5 20 8 8
ORD01 RUN 5 20 18 8
[/pre]
The Name values will correspond to the Excel Table Names in row1 for you input data.

So knowing the Len of each field, you could loop thru this table and fill each field in the input table with the correct number of spaces.

O'd use this table as the basis for mapping Excel data to and screen, rather than explicitly coding each field as your code has.

I'd be doing ALL my coding in Excel VBA!!!!


Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
this is what i use

Code:
sess.moveto 12,12
sess.sendkeys("<EraseEOF>")
 
Hi Remy,
Yes, I would normally use <EraseEOF>, but I was wondering if there is a way to send that command through Excel...?
 
tll,
my code does exactly that. the only difference is the way i declared the object.

you can try it this way.
Code:
Sess0.Screen.moveto
Sess0.Screen.sendkeys("<EraseEOF>")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top