Skip to main content

is there any place where you can see how to do simple calucalation examples with the script editor?

 

i have been trying to do this:

dim status1 as string

dim status2 as string

'read a date like "08"

emreadscreen status1,2,3,57

'substract the date with one month

status2 = status1 - 1

emsetcursor 22,6

'which then should show "07"

emsendkey status2

 

instead i just get "081", how could i fix this?

 


#Rumba

is there any place where you can see how to do simple calucalation examples with the script editor?

 

i have been trying to do this:

dim status1 as string

dim status2 as string

'read a date like "08"

emreadscreen status1,2,3,57

'substract the date with one month

status2 = status1 - 1

emsetcursor 22,6

'which then should show "07"

emsendkey status2

 

instead i just get "081", how could i fix this?

 


#Rumba
Hi besafe,

you are mingling Strings and Integers above, unless you CInt and CStr the various data type you are going to be in trouble.

Are you still trying to figure out how to Add or Subtract 30 days from a date? Maybe you can try this approach, maybe this will help?

Sub Main
Date1 = "14/07/2018"
Date2 = "26/07/2018"

MyDate1_30DaysLater = DateSerial(Year(Date1), Month(Date1), Day(Date1) 30)

If DateSerial(Year(Date1), Month(Date1), Day(Date1) 30) > DateSerial(Year(Date2), Month(Date2), Day(Date2)) then
Msgbox Date1 & " 30 days (" & MyDate1_30DaysLater & ") is more recent than " & Date2
Else
Msgbox Date1 & " 30 days (" & MyDate1_30DaysLater & ") is older than " & Date2
End If
End Sub

Cheers,
Tom

is there any place where you can see how to do simple calucalation examples with the script editor?

 

i have been trying to do this:

dim status1 as string

dim status2 as string

'read a date like "08"

emreadscreen status1,2,3,57

'substract the date with one month

status2 = status1 - 1

emsetcursor 22,6

'which then should show "07"

emsendkey status2

 

instead i just get "081", how could i fix this?

 


#Rumba
Hi besafe,

you are mingling Strings and Integers above, unless you CInt and CStr the various data type you are going to be in trouble.

Are you still trying to figure out how to Add or Subtract 30 days from a date? Maybe you can try this approach, maybe this will help?

Sub Main
Date1 = "14/07/2018"
Date2 = "26/07/2018"

MyDate1_30DaysLater = DateSerial(Year(Date1), Month(Date1), Day(Date1) 30)

If DateSerial(Year(Date1), Month(Date1), Day(Date1) 30) > DateSerial(Year(Date2), Month(Date2), Day(Date2)) then
Msgbox Date1 & " 30 days (" & MyDate1_30DaysLater & ") is more recent than " & Date2
Else
Msgbox Date1 & " 30 days (" & MyDate1_30DaysLater & ") is older than " & Date2
End If
End Sub

Cheers,
Tom

is there any place where you can see how to do simple calucalation examples with the script editor?

 

i have been trying to do this:

dim status1 as string

dim status2 as string

'read a date like "08"

emreadscreen status1,2,3,57

'substract the date with one month

status2 = status1 - 1

emsetcursor 22,6

'which then should show "07"

emsendkey status2

 

instead i just get "081", how could i fix this?

 


#Rumba
i referring to "WD_SearchField" this function returns the position of the search text .but when i trying this my excel getting closed .please help with this.

is there any place where you can see how to do simple calucalation examples with the script editor?

 

i have been trying to do this:

dim status1 as string

dim status2 as string

'read a date like "08"

emreadscreen status1,2,3,57

'substract the date with one month

status2 = status1 - 1

emsetcursor 22,6

'which then should show "07"

emsendkey status2

 

instead i just get "081", how could i fix this?

 


#Rumba
Hi babu,

The WD_SearchPS is also causing Excel to crash for me, but using the generic Function 6 in eHLLAPI works.

e.g.
Private Declare Function hllapi Lib "C:\\Program Files (x86)\\Micro Focus\\RUMBA\\System\\ehlapi32.Dll" (Func%, ByVal Buffer$, bSize%, RetC%) As Long

Sub SearchForString()

Dim Astr As String
Dim Alen As Integer
Dim RetC As Integer
Dim Func As Integer
Dim Location As Integer

FindString = "HELLO"

Func = 1 ' connect PS
Astr = "A"
Alen = Len(Astr)
hllapi Func, Astr, Alen, RetC

Func = 6 ' SearchPS
Astr = FindString
Alen = Len(FindString)
hllapi Func, Astr, Alen, RetC

If Alen > 1 Then
MsgBox "Found at " & CInt(Alen / 80) & ", " & Alen Mod 80
Else
MsgBox "String not found"
End If

Func = 2 ' disconnect PS
Astr = ""
Alen = Len(Astr)
hllapi Func, Astr, Alen, RetC
End Sub

Tom