Skip to main content

Hello all,

 

So what i'm trying to do is prompt an input box, I input today's date in this format X/XX/XX, and it checks to see if a string on the screen matches that and if it does, put a 1 next to the column.

 

I can't seem to pass on the date as a string for it to check against the date on screen.

I have also tried using a variable = a formatted date but that did not work either.

 

Sorry if that's a bit confusing, but here are some examples.

 

First attempt was setting the variable date and trying to match it with the date on screen.

Sub Main

Dim MyString as String, DString as String, RetC as Integer
$D = Format(Month(Date), "00") & "/" & Format(day(Date), "00") & "/" & "18", 20,7

EMConnect "A"

EMReadScreen MyString, 7, 9, 63
EMReadScreen DString, 7, 9, 7
If UCase(MyString) = "$D" then
EMSetCursor 9, 4
EMWaitX 1, RetC
EMSendKey "1"
Else
End if
End Sub

 

Second attempt was setting the date via input box and passing that to match the date on screen.

Sub Main

EMConnect "A"
Dim N as String, RetC as Integer
Title$ = "Date"
Prompt$ = "Please Enter Date XX/XX/XX"
Default$ = ""
X% = 100
Y% = 100
N = InputBox(Prompt$, Title$, Default$, X%, Y%)

EMReadScreen MyString, 7, 9, 63
EMReadScreen DString, 7, 9, 7
If UCase(MyString) = "N" then
EMSetCursor 9, 4
EMWaitX 1, RetC
EMSendKey "1"
else
end if
End Sub

 

 

As always, thank you in advance.


#Rumba

Hello all,

 

So what i'm trying to do is prompt an input box, I input today's date in this format X/XX/XX, and it checks to see if a string on the screen matches that and if it does, put a 1 next to the column.

 

I can't seem to pass on the date as a string for it to check against the date on screen.

I have also tried using a variable = a formatted date but that did not work either.

 

Sorry if that's a bit confusing, but here are some examples.

 

First attempt was setting the variable date and trying to match it with the date on screen.

Sub Main

Dim MyString as String, DString as String, RetC as Integer
$D = Format(Month(Date), "00") & "/" & Format(day(Date), "00") & "/" & "18", 20,7

EMConnect "A"

EMReadScreen MyString, 7, 9, 63
EMReadScreen DString, 7, 9, 7
If UCase(MyString) = "$D" then
EMSetCursor 9, 4
EMWaitX 1, RetC
EMSendKey "1"
Else
End if
End Sub

 

Second attempt was setting the date via input box and passing that to match the date on screen.

Sub Main

EMConnect "A"
Dim N as String, RetC as Integer
Title$ = "Date"
Prompt$ = "Please Enter Date XX/XX/XX"
Default$ = ""
X% = 100
Y% = 100
N = InputBox(Prompt$, Title$, Default$, X%, Y%)

EMReadScreen MyString, 7, 9, 63
EMReadScreen DString, 7, 9, 7
If UCase(MyString) = "N" then
EMSetCursor 9, 4
EMWaitX 1, RetC
EMSendKey "1"
else
end if
End Sub

 

 

As always, thank you in advance.


#Rumba
I actually seem to have resolved it myself.
I needed one less 0 in the month and I had the positions for the date at the end of the variable.