Author Topic: Does anyone have a keybindable "insert timestamp" macro?  (Read 8553 times)

HTrammel

  • Junior Community Member
  • Posts: 8
  • Hero Points: 0
Does anyone have a keybindable "insert timestamp" macro?
« on: February 08, 2007, 08:40:05 PM »
I am really surprised that there is not one built into SlickEdit.  If anyone has one that they would be willing to share, I would appreciate it.

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #1 on: February 08, 2007, 09:29:17 PM »
Here we go ...

Code: [Select]
_command void date () name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL)
{
   _insert_text (_date ('L'));
}
// short date e.g. '070208'
_command void sdate () name_info (','VSARG2_MARK|VSARG2_TEXT_BOX|VSARG2_REQUIRES_EDITORCTL)
{
   _str month, day, year;
   parse _date() with month'/'day'/'year;
   if (length(month)<2) month='0'month;
   if (length(day)<2) day='0'day;
   if (length(year)>2) year=substr(year,3);
   _insert_text ( year month day );
}

Have fun,

HS2

HTrammel

  • Junior Community Member
  • Posts: 8
  • Hero Points: 0
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #2 on: February 08, 2007, 09:48:31 PM »
Thank you very much.

H

HTrammel

  • Junior Community Member
  • Posts: 8
  • Hero Points: 0
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #3 on: February 10, 2007, 03:05:53 AM »
Thanks again for the date function.   The _date() gives me the date information.  How about "time"?  I cannot find a _time() or similar function.  Is something like that available?

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #4 on: February 10, 2007, 10:35:37 AM »
??? There is a _time() function (@see builtins.e)
Code: [Select]
_insert_text (_time ('L'));
HS2

HTrammel

  • Junior Community Member
  • Posts: 8
  • Hero Points: 0
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #5 on: February 10, 2007, 03:11:56 PM »
Thanks again.  I guess I did not know where to look for it.  I'm definitely a newbie with slick-c.  I'll look at builtins.e and see what else I am missing.   :)

hs2

  • Senior Community Member
  • Posts: 2762
  • Hero Points: 292
Re: Does anyone have a keybindable "insert timestamp" macro?
« Reply #6 on: February 10, 2007, 03:19:43 PM »
Slick help is also very helpful.
see 'Help->Contents->Slick-C Macro Programming Guide / Macro Functions by Category'

HS2