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
 

it isn't working.
i changed all the CLng to CDbl or CSng (tried both) and neither works
the code i have is the code from your post 12 Feb 09 16:50
I did read it, and I STILL want to see your code!!!

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]
 
Code:
Set MyScreen = Sess0.Screen
         Set MyArea = MyScreen.Area(6, 17, 6, 22,, 3)
           
        mysum1 = CDbl(MyArea)
        If IsNumeric(Mysum1) Then
        If MySum1 < CDbl(85.00) Then
    
        Msgbox "amount must be at least $85.00"
    Else
        DiffMyArea = CDbl(MySum1) - CDbl(75.00)
  
    
    Set MyArea = MyScreen.Area(17,17,17,22,,3)
	MyArea.Select
	MyArea.Copy
	Set MyArea = MyScreen.Area(6,17,6,22,,3)
	MyArea.Select
	MyArea.Paste
    MyScreen.PutString CDbl(DiffMyArea), 6,  17
    
    End IF
End If
[code/]
 


All I can say is that this works for me.
Code:
    Set MyArea = MyScreen.Area(10, 46, 10, 49, , 3)

    If IsNumeric(MyArea.value) Then
        DiffMyArea = CDbl(MyArea) - CDbl(0.5)
    End If

    MyScreen.PutString "    ", 10, 46
    MyScreen.PutString DiffMyArea, 10, 46
I had
[tt]
8.0
[/tt]
I got
[tt]
8.0
[/tt]
7.5

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]
 


Was
[tt]
100.
[/tt]
Got
[tt]
99.5
[/tt]


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]
 
even 85.00 returns 10 0
no decimal and digits are out of place
 



You are not CLEARING the area!!!!!!!!!!!!!

Notice my code???

Pay attention!!!

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 i already changed that????????????? lol

but i did just notice you was using
If IsNumeric(MyArea.value)
instead of
If IsNumeric(Mysum1) Then
and your not using mysum
 



WORKS!!!
Code:
    Set MyArea = MyScreen.Area(10, 46, 10, 49, , 3)

    MySum = CDbl(MyArea)

    If IsNumeric(MySum) Then
        DiffMyArea = MySum - CDbl(0.5)
    End If
[b]
    MyScreen.PutString "    ", 10, 46[/b]
    MyScreen.PutString DiffMyArea, 10, 46


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, Again
it looks like it works with a small number it messes up with number such as 100.00 please try that
 



What do you mean by "it messes up"?

Please let me have a glimpse of what's in your head!

I cannot read your mind!

Please be exact!

It seems that each simple question, requires TOO MANY requests for clarification!

HELP ME!!!

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]
 
i have posted several times
wow?

anyway

85.00 returns 10 0
100.00 returns 25 00

no decimal and digits are out of place

and i also asked you to try a larger number that way you could see exactly what it is doing if you cant follow the posts.
 



Ohhhhhh, lordie!!!

CLEAR the area BEFORE you put your stuff in it!!!!!!!!!!!

Do you realize how many times I have advised you to do this, an yet you complete ignore what will be your solution.

Observe MY CODE!!!!!! 13 Feb 09 12:44


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]
 
i feel like you are getting paid for each post lol

here is my code as i stated eairler i changed it to match yours.

take a look and let me know if i am missing something
Code:
Set MyScreen = Sess0.Screen
         Set MyArea = MyScreen.Area(6, 17, 6, 22,, 3)
           
        mysum1 = CDbl(MyArea.Value)
        If IsNumeric(Mysum1) Then
        If MySum1 < CDbl(85#) Then
    
        Msgbox "amount must be at least $85.00 to "
    Else
        DiffMyArea = CDbl(MySum1) - CDbl(75#)
  
    
    Set MyArea = MyScreen.Area(17,17,17,22,,3)
	
    MyScreen.PutString"    ", 6, 17
    MyScreen.PutString CDbl(DiffMyArea), 6,  17
    
    End IF
    End If
 



Tell me what happens when you run it.

Post ALL the relevant values before and after.

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]
 




Code:
    MyScreen.PutString"    ", 6, 17
1. why is there no SPACE between PutString and the literal?

2. why do you only have FOUR SPACES when your AREA had SIX?

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]
 

i have posted several times
wow?

anyway

85.00 returns 10 0 ->instead of 10.00
100.00 returns 25 00 ->instead of 25.00

no decimal and digits are out of place

and i also asked you to try a larger number that way you could see exactly what it is doing if you cant follow the posts.


 


how about changing

Code:
MyScreen.PutString CDbl(DiffMyArea), 6,  17

to
Code:
MyScreen.PutString format(DiffMyArea,"fixed"), 6,  17
 



Problem is, I have a 4 byte field -- you have a 6 byte field.

You must CLEAR a six byte field.

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]
 
whshooo!!

success!
it was this change that fixed it
MyScreen.PutString format(DiffMyArea,"fixed"), 6, 17

thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top