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

Math question 1

Status
Not open for further replies.

cheetahz

Technical User
Dec 4, 2008
101
0
0
US
Is it possible to take some numbers from attachmate screen and do math with them?



I will pase them back to a different location
 


Hi,

All the data that you get from an emulator is TEXT.

You can use conversion functions to convert numeric digit strings to numbers.

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
would you have an example of that?
 



Did you check Extra HELP on conversion?

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
yes that is why i asked if you meant to use VAL to convert the text to a val to execute a math function on it.

is that correct?
 



Val
CInt
CLng
CDbl



Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
could you show me an example? or any ideas of what this would look like i cant seem to get it.

i am grabbing a number from the screen (text)
if the number is greater than 85.00 then i subtract 75.00 from the number and paste it or put the number back to the screen and continue code

 



What code are you using and what is the result you are getting?

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
this is what i have now but i cant get the syntax correct
new at basic so don't laugh



Code:
Set MyScreen = Sess0.Screen
        Set MyArea = MyScreen.Area(6,17,6,22,,3)
	MyArea.Select
	MyArea.Copy
        if isnumeric(MyArea)  then
   DiffMyArea = clng(MyArea)-clng(75.00)
end if

       If MyArea.Value < 85.00   Then
		Msgbox "amount must be at least greater than $85.00"
  End If
 


What value is on the emulator at 6,17,6,22?

What result do you get?

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
it is differnt all the time and it can be
2 or 3 digits

example
50.00
150.00
 




...........and the result??????????

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
now it seemed to work does the sytax look correct to do what i have mentioned?
 



Help me out here! Please don't make me ask for every little piece of vital information!

Object error on WHAT statement? That's part of the result that you are getting!!!


Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
ok?
no error now but it pastes back the original number so it is doing no math with the code that i have
 




You have no paste in the code you posted!!!

The calculation is in DiffMyArea, and it WORKS!!!

What are you talking about???

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
so what is the sytax to get the number back to the screen

Code:
Set MyScreen = Sess0.Screen
        Set MyArea = MyScreen.Area(6,17,6,22,,3)
	MyArea.Select
	MyArea.Copy
        if isnumeric(MyArea)  then
   DiffMyArea = clng(MyArea)-clng(75.00)
end if

       If MyArea.Value < 85.00   Then
		Msgbox "amount must be at least greater than $85.00"
  End If
    Set MyArea = MyScreen.Area(6,17,6,22,,3)
	
        MyArea.Paste
 
Code:
Set MyScreen = Sess0.Screen
        Set MyArea = MyScreen.Area(6,17,6,22,,3)

        if isnumeric(MyArea)  then
   DiffMyArea = clng(MyArea)-clng(75.00)
end if

       If DiffMyArea  < 85.00   Then
        Msgbox "amount must be at least greater than $85.00"
  End If
    MyScreen.Area(6,17,6,22,,3) = DiffMyArea

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top