Sending a message at a chosen time

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 455
Joined: Fri Feb 24, 2006 9:45 am

Sending a message at a chosen time

Post by elanorb » Thu Jan 30, 2014 11:47 am

Hi

In last night's webinar we briefly discussed how to send a message at a particular time. To do this in the desktop you can use the send in time command but this takes a delay time rather than a specific time. To work out the number of seconds between "now" and when you want to send the message you can do something along the lines of

Code: Select all

local tNow, tThen, tTimeDifference
   
   put the date into tNow
   convert tNow to seconds
   
   put the label of button "year",the label of button "month", the label of button "date",the label of button "hour",the label of button "minute",the label of button "second",1 into tThen
   convert tThen to seconds
   
   put tThen - tNow into tTimeDifference
   answer tTimeDifference
On mobile if you are using local notifications you also need to give the time in seconds so the convert command is useful in that case too.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Sending a message at a chosen time

Post by pTom » Mon Feb 24, 2014 4:08 pm

What is I want to use this on the server (RunRev, in particular)?

Here is what I would like to do:
I want to be able to post an article for my app but don't want it to show up until a particular time and date. I would like to be able to load it now but now have it show up for a few days or weeks. Is this possible? I assume the script would need to apply to the server and not the app or am I wrong?

Any advice on how to accomplish this?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Sending a message at a chosen time

Post by LCNeil » Wed Feb 26, 2014 3:17 pm

Hi Tom,

I've spoken to our server guys and they came back with the following-

"you need a script on the server which you would execute whenever (probably using a cron job) which would write out a .htaccess file in the directory containing the news articles on the server, denying and granting access".

This is a pretty involved task and is a bit outside the scope of what we can provide in the idea2app course.

However, we can suggest another method which would be far simpler to implement.

You could have an index file or an additional tab column in your details.txt file that contains the date that the article should be released (e.g. 3/14/2014). This column would not be added to your datagrid and would only be used for reference.

You could then use "the date" function to return the date of the device and show only the article that match this date or are before this date. It would require some work to your application to implement this but it does provide an easier option than working with server side scripts.

Kind Regards,


Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
——

Post Reply

Return to “idea2app and Coding School”