mIRC Home    About    Download    Register    News    Help

Print Thread
#134782 04/11/05 07:43 PM
Joined: Aug 2005
Posts: 25
E
enotsoc Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2005
Posts: 25
ok i run a rss bot that is used to post and has a search function, so when new urls are added it stamps date/time in the log. i would like to now add for when a user uses a search function it will display how long ago the post was added .original look is like this in the log file
CNN NEWS HEADLINE Url: www.cnn.com/blah.htm | Fri Nov 04 13:34:34 2005
and now would like to have it show when a user searches
CNN NEWS HEADLINE Url: www.cnn.com/blah.htm | Fri Nov 04 13:34:34 2005 was added 2 days 4hrs 38secs ago. all help is appreciated =)

#134783 04/11/05 08:43 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Add this to the end of your msg line:

was added $duration($calc($ctime - $ctime(Fri Nov 04 13:34:34 2005))) ago.

***Note that you need to replace the date/time with a variable or whatever you are using to get it in the first place.

If you need it to display months and years accurately, look up $DateXpander on mircscripts.org. To use that script in this example, you would just replace $duration with $DateXpander (with that script loaded).


Invision Support
#Invision on irc.irchighway.net
#134784 04/11/05 11:08 PM
Joined: Aug 2005
Posts: 25
E
enotsoc Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2005
Posts: 25
thats the problem, i dont know how to make it read the date from the txt file for that individual line that gets responded in the search

#134785 05/11/05 04:05 AM
Joined: Aug 2005
Posts: 25
E
enotsoc Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2005
Posts: 25
Softpedia >> Music Organizer Deluxe 2.5 (Shareware) >> http://www.softpedia.com/get/Office-tools/Diary-Organizers-Calendar/Music-Organizer-Deluxe.shtml Thur Nov 03 22:53:07 2005
Sky News >> Trio Convicted Of Student's 'Honour Killing' >> http://www.sky.com/skynews/article/0,,30100-1201563,00.html?f=rss Fri Nov 04 21:47:07 2005
CNN - Latest >> Doctor: Terror suspects being force fed >> http://www.cnn.com/rssclick/2005/WORLD/americas/11/04/gitmo.starvation/index.html?section=cnn_latest Wed Nov 02 21:53:07 2005

my problem is how do i get it to read the time from that txt file so i can use the datexpander to show how long ago it was posted. in the rss log i have say 100 urls all with diff post times. so id needd a way to grab the time from the log so when it is sent back in the search it shows the duration since it was first posted and display say like this
<user1> !search * <-- which i have set to display the last 3 posts and in a msg they woudl get...

Softpedia >> Music Organizer Deluxe 2.5 (Shareware) >> http://www.softpedia.com/get/Office-tools/Diary-Organizers-Calendar/Music-Organizer-Deluxe.shtml was posted 1day 24hrs 13min 28secs ago.
Sky News >> Trio Convicted Of Student's 'Honour Killing' >> http://www.sky.com/skynews/article/0,,30100-1201563,00.html?f=rss was posted 2 hrs 28mins 45scs ago
CNN - Latest >> Doctor: Terror suspects being force fed >> http://www.cnn.com/rssclick/2005/WORLD/americas/11/04/gitmo.starvation/index.html?section=cnn_latest was posted 2days 19hrs 14mins 13secs ago.

how do i get it to read the time from the original log at the very top? im sorry if im not understanding right away. sorry if i didnt make it clear that that are too many posts for me to manually enter the date of the post. tring to find a way to make it automatically done in the search responce.

Last edited by enotsoc; 05/11/05 04:10 AM.
#134786 07/11/05 02:55 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
As long as the times are always like that, you can get the time from the line with:

$gettok(text,-5-,32)

Replace the red part with the variable or whatever you have the line in. That will give you the time from the line.

You can either store that $gettok into a variable and then use the variable with the $datexpander identifier, or else you can just insert that part right into the code above where the date goes.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard