Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 01, 2015, 11:14:29 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: New Script FARR Plugin: Clock  (Read 18142 times)

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 22
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Donate to Member
New Script FARR Plugin: Clock
« on: February 17, 2008, 11:02:35 PM »
Overview:
This plugin displays the current date/time in a variety of formats.

Info:
http://gogogadgetsco...uters/software/farr/

List of commands:
cl : list current date/time

Download:
http://gogogadgetsco...farr/clock/Clock.zip

clock.jpg

Special thanks goes to ecaradec for Fscript.
http://www.donationc...ex.php?topic=12232.0

taichimaster

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 160
    • View Profile
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #1 on: February 17, 2008, 11:27:25 PM »
Pretty cool plugin.  You seem to have left out the UTC format though :)

It would be even cooler if you could extend the plugin to show the current time in different cities.

cl moscow
cl "hong kong"

Maybe you can scrap the output of http://www.timeanddate.com/worldclock/ ?

Another idea would be to display the calendar of the specified month.  Something like the "cal" command in *nix.

Something like:

$ cal 2 2008
   February 2008
Su Mo Tu We Th Fr Sa
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #2 on: February 18, 2008, 12:18:24 AM »
very cool.  :up:
my only suggestion is to not call it cl, and instead maybe "fcl" so it doesnt interfere with normal searching for files that might start with cl.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #3 on: February 18, 2008, 12:22:34 AM »
this is close to my request here, i wonder if it could be added:
http://www.donationc...71.msg86321#msg86321

i think you could add that ability to your plugin if you let the options file provide an OFFSET +- hours for each entry, and a label for each entry so user could search by entry name.  just an idea!

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,708
    • View Profile
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #4 on: February 18, 2008, 12:49:14 AM »
very cool.  :up:
my only suggestion is to not call it cl, and instead maybe "fcl" so it doesnt interfere with normal searching for files that might start with cl.

Or "cl "
Code: [Select]
^cl (.*)

This is the convention that I've adopted for all aliases + plugins : they end with a space.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #5 on: June 09, 2008, 10:08:56 AM »
Just added this to the official FARR plugin list.

Couple of quick comments:
  • The zip file actually has the directory Clock inside it (My winzip context menu extension does this by default as well if you right click on the directory and say to zip, rather than selecting the files inside the directory and saying zip).  This actually can cause a problem for the updater since it just unpacks the contents into the plugin subdirectory resulting in a two-level deep install.  Can you fix that?
  • Changing from cl to fcl would be good idea or doing as Armando says with ^cl (.*)


Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,809
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #6 on: June 14, 2008, 08:50:07 AM »
I just installed this plugin and it's quite neat, but thought that adding the ability to display future or past dates would be beneficial too.

Being javascript it's easy to change the plugin, so I added the following before the script formats the date:
Code: Javascript
  1.   var NewDate = new Date()            // Get current Date
  2.  
  3.   if (querynokeyword != "") {
  4.     // Why is querynokeyword always just the first word??
  5.     var arrayOfQuery = queryraw.split(" ");
  6.        
  7.     for (var i=1; i < arrayOfQuery.length; i++) {
  8.       if (IsNumeric(arrayOfQuery[i]) == true ) {
  9.         var ip = i + 1;
  10.         if (ip < arrayOfQuery.length ) {
  11.           switch(arrayOfQuery[ip].toLowerCase()) {
  12.             case "year":
  13.             case "yyyy": {// year
  14.             NewDate.setFullYear(NewDate.getFullYear() + parseFloat( arrayOfQuery[i]));
  15.             break;
  16.             }
  17.             case "quarter":
  18.             case "q": { // quarter
  19.             NewDate.setMonth(NewDate.getMonth() + (parseFloat( arrayOfQuery[i])*3));
  20.             break;
  21.             }
  22.             case "month":
  23.             case "m": { // month
  24.             NewDate.setMonth(NewDate.getMonth() + parseFloat( arrayOfQuery[i]));
  25.             break;
  26.             }
  27.             case "day":
  28.             case "y": // day of year
  29.             case "d": // day
  30.             case "w": { // weekday
  31.             NewDate.setDate(NewDate.getDate() + parseFloat( arrayOfQuery[i]));
  32.             break;
  33.             }
  34.             case "week":
  35.             case "ww": { // week of year
  36.             NewDate.setDate(NewDate.getDate() + (parseFloat( arrayOfQuery[i])*7));
  37.             break;
  38.             }
  39.             case "hour":
  40.             case "h": { // hour
  41.             NewDate.setHours(NewDate.getHours() + parseFloat( arrayOfQuery[i]));
  42.             break;
  43.             }
  44.             case "minute":
  45.             case "n": { // minute
  46.             NewDate.setMinutes(NewDate.getMinutes() + parseFloat( arrayOfQuery[i]));
  47.             break;
  48.             }
  49.             case "second":
  50.             case "s": { // second
  51.             NewDate.setSeconds(NewDate.getSeconds() + parseFloat( arrayOfQuery[i]));
  52.             break;
  53.             }
  54.             case "milliseconds":
  55.             case "ms": { // second
  56.             NewDate.setMilliseconds(NewDate.getMilliseconds() + parseFloat( arrayOfQuery[i]));
  57.             break;
  58.             }            
  59.           }
  60.         }
  61.       }
  62.     }
  63.   }
  64.  

Works fine, but it raised some questions about Licensing: There was not a Licence defined in the file or on his website, so I'm not sure if I should have done that or not?

I wonder if we:
  • Should ensure that all Plugins have some sort of Licence attached to them?
  • Should have an area for Open Source plugins, especially the FScript variety, as they are so easy to change?

 :-\ What do people think?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #7 on: June 15, 2008, 09:54:25 AM »
Quote
Works fine, but it raised some questions about Licensing: There was not a Licence defined in the file or on his website, so I'm not sure if I should have done that or not?

i don't want to speak for gogogadgetscott, but given the context, and the fact that source is released with this, and the spirit of this site, it seems clear to me that it's a pure good thing to share modifications like this, and i would consider these plugins open source by default  :Thmbsup:

I think basically all FARR plugins have been released as open source -- though maybe not "formally" with a license.  it's a good idea to include a clear license in them saying so.  we should choose a default license and include it with all the samples, then others will follow suit.

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 22
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #8 on: June 15, 2008, 10:49:12 AM »
I apologize for not replying to the above comments. I have had some performance issues with FARR (searching history is slow) and am currently evaluating Lanchy  :(

FARR Plugin: Clock is now officially released using GPLv3. Do as you wish with it  :D

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #9 on: June 15, 2008, 10:52:40 AM »
there's no reason searching history should be slow (you can email me at mouser@donationcoder.com if you want to experiment and try to get it fixed); but otherwise, use whatever program works best for you  :Thmbsup:

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 22
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #10 on: June 15, 2008, 10:57:03 AM »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #11 on: June 15, 2008, 10:58:25 AM »
ok, i'm putting the new file format save/load at top of my todo list, and we'll see if we can't get this solved asap.

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 22
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #12 on: June 15, 2008, 11:01:55 AM »
Thank you, mouser. Your the best  8)

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,809
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #13 on: June 17, 2008, 04:04:35 AM »
I think basically all FARR plugins have been released as open source -- though maybe not "formally" with a license.  it's a good idea to include a clear license in them saying so.  we should choose a default license and include it with all the samples, then others will follow suit.

Cool, sounds like it should be  :)

How about hosting the file? At the moment it's on GoGoGadetScott's site

FARR Plugin: Clock is now officially released using GPLv3. Do as you wish with it  :D

I've just about finished adding TaiChiMaster's request for World Time Zones.

I was having an issue with RegEx's in the JavaScript though: they don't seem to be working. Is that FScript.dll or FARR?


ecaradec

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 409
    • View Profile
    • Blog & Projects
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #14 on: June 21, 2008, 05:28:49 AM »
I was having an issue with RegEx's in the JavaScript though: they don't seem to be working. Is that FScript.dll or FARR?

What is your issue with regexes ?
- FARR regexes are used to filter output (output many results and let farr filter and sort the results )
- You can use javascript to filter your results but you have to implement sorting and filtering

Blog & Projects : Blog | Qatapult | SwiffOut | FScript

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,809
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #15 on: June 21, 2008, 09:37:43 PM »
I was having an issue with RegEx's in the JavaScript though: they don't seem to be working. Is that FScript.dll or FARR?

What is your issue with regexes ?
- FARR regexes are used to filter output (output many results and let farr filter and sort the results )
- You can use javascript to filter your results but you have to implement sorting and filtering

My issues were my code  :-[ or at least my understanding of some code I'd borrowed. It was neither Fscript or FARR (not surprising  ;)): I've got my RegExes working fine in JavaScript, thanks.

Did have some questions over in your Fscript thread tho...  :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #16 on: June 25, 2008, 05:10:33 PM »
gogogadget, can you see if version 2.12.03 solves the slow read/write of settings file issue?

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,218
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #17 on: July 24, 2008, 02:43:06 AM »
Another idea would be to display the calendar of the specified month.  Something like the "cal" command in *nix.

you can use the plugin mentioned in this thread with some relevant console tools to make it work.

gogogadgetscott

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 22
  • Mechanical engineer who has inexplicable knowledge
    • View Profile
    • GoGoGadgetScott's Site
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #18 on: August 31, 2008, 09:33:56 PM »
I am currently running v2.30.31 and find the performance has much improved on my machine. Thank you, mouser.

delio77

  • Supporting Member
  • Joined in 2009
  • **
  • gravatar avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #19 on: April 06, 2010, 05:11:52 PM »
The copy part of this doesnt work on my win7 boxes.

CL works but selecting the right format doesnt copy it to the clipboard.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,971
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: New Script FARR Plugin: Clock
« Reply #20 on: April 06, 2010, 05:19:13 PM »
there are other clipboard functions in farr.. i wonder if they are all broken on win7?
if you type: paste
and select one of the results, can you see if it works.