Dynamic Data in Date and Time text image - urgent

In my application I need to capture the current system date and Time Spent for the particular activity. But this will vary based on the script execution date and also the time taken to execute that script.
When tried the below mentioned script suggested by you, I am not clear in using the captured image in the syntax. (eg: Date current date 24-December-2008 Time spent 1.0 hours and while executing the same on the next day my current date and time spent needs to be changed as 25-December-2008 & 1.5 hours )

put formattedTime("%1m/%e/%Y") into theDate
if not imageFound(Text:theDate, TextSize:“12”, TextFont:“Arial”) then
logError “Date incorrect”
end if

How to handle the dynamic data in the text image?

If you want to capture those values, the best approach will be to script Eggplant to select the date and the elapsed time and copy them to the clipboard:

drag "DateLabel" -- an image identifying the starting point of where the date can be found
drop "DateEnd" -- an image identifying a point at the end of the date
typeText command, "c" -- copy the text to the clipboard
put the remoteClipboard into runDate

then do the same thing for the elapsed time.

The code provided previously would just check that today’s date appeared on the screen; it always uses the current date, but the format would need to change slightly to match your example (and you’ll need to adjust the font properties to match your application):

put formattedTime("%1e-%B-%Y") into theDate
if not imageFound(Text:theDate, TextSize:"12", TextFont:"Arial") then
logError "Date incorrect"
end if 

Hi,

We had tried this command but still unable to complete the scenario. Can you please inform in detail about how to compare the date content in clipboard with the current date.

Hi,

Assume system date format and application date format varies in this scenario.

thanks
shankarigopal

Hi,
Thanks for your quick response. We tried with the following code. But the issue is our application screen does not mark the text if i will drag and drop, just like a Adobe Reader. This means nothing is getting copied to the Clipboard. The dynamic Date/ Time image which we are trying to capture is available in a Report page(where the actions like click, drag and drop are not permitted).How do we handle this case?

Code:
drag “DateLabel” – an image identifying the starting point of where the date can be found
drop “DateEnd” – an image identifying a point at the end of the date
typeText command, “c” – copy the text to the clipboard
put the remoteClipboard into runDate
then do the same thing for the elapsed time.

Given what you described here it sounds like the best solution is to verify the current date using the Text Image Generator. The Text Image Generator is capable of creating a dynamic image given a variable text string and a set of font/text characteristics.

This sample code is an example but you will need to modify it for your specific scenario/environment:

	put formattedTime("%1e-%B-%Y") into theDate 
	if not imageFound(Text:theDate, TextSize:"12", TextFont:"Arial") then 
		logError "Date incorrect" 
	end if

*- The “formattedTime” function described in SenseTalk Reference (in the Eggplant Help Viewer) will let you display the current date using a variety of formating options.

** - Then when you generate the image you must specify Text Size, Font, Color, Background Color, to match how it is displayed on your SUT. More information on the Text Image Generator, including examples, can be found in Chapter 2 of Using Eggplant (also in the Eggplant Help Viewer)