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!

Math question 1

Status
Not open for further replies.

cheetahz

Technical User
Dec 4, 2008
101
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
 
does the decimal in the number make any difference?
 



Here's a tip that can help you know exactly where you can enter data.

Tab to a field and start entering 9's or X's...
[tt]
OVERRIDE WORKWEEK CLK
x 66 xxxx xxxx xxxx xxxx xxxx
^
|
This is column 46 --+

[/tt]
the ACTUAL Area, for the code I posted, should have been...
Code:
   .Area(10, [b]46[/b], 10, 49)
anything OUTSIDE that area will probably result in an error.

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]
 
if i put in the copy and select statement it gets the number needing changed on the clipboard it just doesn't change it.


man?
 



Can you type anything in 6, 17?

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, as i said it normally gets changed manually.

i am thinking there is a protection on it and i will have to test the code on the correct scenerio

i will post back for sure if it works
 



Please TAB to the locations for entry in row 6, and put x's or 9'x in row 6.

COPY row 6

Paste row 6 here.

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]
 
what would the code look like to post results to notepad
 




This is like talking to a ROCK!!!!

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]
 
N/A AMOUNT xxxxx AUTH CODE 000000 Abcd abcd C
 
Please post the current code you are using.

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:
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
	Dim Sessions As Object
	Dim System As Object
        Dim amount As Object
        Dim total As Object
        Dim myStr As Object, Sys As Object
        Dim MyScreen As Object
        Dim MyArea As Object
        Dim DiffMyArea
	Set System = CreateObject("EXTRA.System")	' Gets the system object
	If (System is Nothing) Then
		Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
		STOP
	End If
	Set Sessions = System.Sessions

	If (Sessions is Nothing) Then
		Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
		STOP
	End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
	g_HostSettleTime = 3000		' milliseconds

	OldSystemTimeout& = System.TimeoutValue
	If (g_HostSettleTime > OldSystemTimeout) Then
		System.TimeoutValue = g_HostSettleTime
	End If

' Get the necessary Session Object
	Dim Sess0 As Object
	Set Sess0 = System.ActiveSession
	If (Sess0 is Nothing) Then
		Msgbox "Could not create the Session object.  Stopping macro playback."
		STOP
	End If
	If Not Sess0.Visible Then Sess0.Visible = TRUE
	Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	
' This section of code contains the recorded events
	'Sess0.Screen.Sendkeys("c96<Enter>")	
	'Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	'Sess0.Screen.Sendkeys("u<Enter>")	
	'Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
	'Sess0.Screen.Sendkeys("10<Tab>p<Tab>")
        'Sess0.Screen.Sendkeys("sometext")
         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 DiffMyArea  < 85.00   Then
        'Msgbox "sometext"
  'End If
    
    
    MyScreen.PutString DiffMyArea, 6, 17




	System.TimeoutValue = OldSystemTimeout
End Sub
 



remove

MyArea.Select
MyArea.Copy

Did you not see that I had removed those statements in the code I posted SEVERAL TIMES?

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]
 
by the way i have tried it both with and without this
MyArea.Select
MyArea.Copy
 


When I use COPY, I loose the value in MyArea and consequently the calculation does nothing.

When I remove the COPY, I get the calculation and write the calculated value to the emulator.

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 removed it and nothing

i put in code to copy from line 7 and paste to line 6
and it works fine


this is starting to make my head hurt ;-)
 
i notice you are using # do i need this to format the number correctly
 


No, CLng converts is.

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]
 


Try to clear the field before you PUT the string.

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]
 
see if this helps:
i added mysum1 = CLng(MyArea) and used mysum1 for calculations



Code:
mysum1 = CLng(MyArea)
If IsNumeric(Mysum1) Then
        If MySum1 < CLng(85#) Then
    'If CLng(MyArea) < CLng(85#) Then
        Msgbox "amount must be at least greater than $85.00"
    Else
        DiffMyArea = MySum1 - CLng(75#)
    'DiffMyArea = CLng(MyArea) - CLng(75#)
    MyScreen.PutString DiffMyArea, 6,17
    End IF
End If
 
I will try that when i get back to work tomarrow
thanks for all the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top