Page 1 of 1

Formatting a date in Control UI action

Posted: 06 Nov 2016 04:39
by Daisy666
Hello Everyone,

I am working on a flow to control the UI of Google Calendar.

Since there is no "new reminder" action in Automagic right now, I am making this flow to automatically control the google calendar UI to creat a new reminder.

There is an annoying situation when the calendar was last accessed and left with a, like say, date selection pane open. Then my flow won't work as the interface is different.

Therefore I use a while loop to continue to test if the top left corner contains the text of the current month (now is November), if not, will use back() script to getme to the correct page before I can initiate a new calendar reminder item.

Here comes my difficulty: I tried to use a variable in the while loop to show the current month in full name, but was not successful. My script (in Control UI action) is as below:

while(getText(415,182)!=getDate(getDate(),MMMM))
{back();
sleep(500);}

Automagic keeps saying something like illegal grammar and pattern cannot contain "n" or something. I don't quite understand.

If I replace the variable with a static "November", flow would run as expected:

while(getText(415,182)!="November")
{back();
sleep(500);}

Where could I possibly be wrong? Please help. Thank you very much.

Re: Formatting a date in Control UI action

Posted: 07 Nov 2016 19:58
by Martin
Hi,

You could use following script to get the formatted month name:
month = "{triggertime,dateformat,MMMM}";
while(getText(415,182)!=month)
{back();
sleep(500);}

The getDate-function with a pattern can be used to convert a text to a date. The pattern needs to be specified as a string:
date = getDate("2016.11.07 09:00:00", "yyyy.MM.dd HH:mm:ss");

Regards,
Martin