topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday April 16, 2024, 2:36 am
  • Proudly celebrating 15+ 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: IDEA: Insert date and time into internet explorer - or other text field  (Read 17607 times)

brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
Hi From a first time requester...  ,

I need an easy-to-use function to insert the current date and time into a text field, specifically into IE7.  The format I'd like is
   [#- day-of-week  month date, year time - *] where the * and # represent  bits of arbitrary text, like my initials for example.

Control over the formatting would be nice but is not strictly necessary. Invocation should come from a  hot key or as right click context menu or a browser add-in or menu tool or the like. 

Kind of like Skrommel's  "now" script for AHK, but with classier formatting   :D

Anyone know of an existing tool like this???

Thanks,
Chuck
Chuck Brotman

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Look at the options in CH&S available here, on DonationCoder, from mouser.

I think you can set up what you want and 'hot-key' it into place:

 Clipboard Help+Spell is a text-based clipboard utility with the following features:

    * Database stores history of all past text clipboard entries for easy viewing, modification, and search
    * Use it for keeping hierarchical notes - search, sort, filter by text, modification date, last view date
    * Super easy and super fast search function - or use complex filters if you need them - you'll never have a problem finding a note again!
    * Organize your notes and clips any way you want - show them all or view by group or category; view your clips any way you like
    * High-quality spellcheck - underlined mistakes; learning spellchecker
    * Configurable hotkeys for common functions
    * Powerful text formatting options - make your own presets for common functions
    * Simple functions for copying and pasting into and out of other applications


brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
cranioscopical,

Clipboard Help+Spell?? Clipboard Help+Spell!!  Now, how cool is that!?  I already have it and it's running and siitting in my notification area!  I didn't know/remember that it had date functions. I'll have to go check it out (again! doh!)


Thanks for your reply and information!!!


Chuck
Chuck Brotman

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
If you install autohotkey you can use below script in any text field you want. Copy paste into a text file and change the extension to .ahk and then double click to run it.

All you need is typing "]d" "}d" etc. Just check out the script below. It is very easy. This will change or add the date on the fly no need for additional application. I originally found this script in one of the ahk documents btw. It is not my script but I use it everyday.



;script starts here
:*:]d::  ; This hotstring replaces "]d" with the current date and time via the commands below.
FormatTime, CurrentDateTime,, d/M/yyyy ;h:mm tt  ; It will look like 9/1/2005 3:53 PM
SendInput %CurrentDateTime%
return

:*:}d::
FormatTime, CurrentDateTime,, yyyy_M_d
SendInput %CurrentDateTime%
return

:*:)d::
FormatTime, CurrentDateTime,, d_M_yyyy
SendInput %CurrentDateTime%
return

:*:*d::
FormatTime, CurrentDateTime,, M_d_yyyy
SendInput %CurrentDateTime%
return
« Last Edit: June 13, 2008, 04:36 PM by kartal »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :) Here's TimeStamp 2.1!

Use the tray menu or hotkeys to send user defined times and dates to the active window.
Doubleclick the tray icon to send the last used timestamp.
Use the Settings menu in the tray to change the timestamps and hotkeys.
Default hotkeys are F1 and F2.

Skrommel


;TimeStamp.ahk
; Use the tray menu or hotkeys to send user defined times and dates to the active window.
; Doubleclick the tray icon to send the last used timestamp.
; Use the Settings menu in the tray to change the timestamps and hotkeys.
;Skrommel @ 2008


#SingleInstance,Force
#Persistent,On
#NoEnv
SendMode,Input
SetWorkingDir,%A_ScriptDir%
SetBatchLines,-1
SetWinDelay,0
SetKeyDelay,0
AutoTrim,Off

applicationname=TimeStamp
Gosub,INIFILE
Gosub,MENU

string:=stamp1

Gui,+LastFound
guiid:=WinExist()
DllCall("RegisterShellHookWindow",UInt,guiid)
msgnum:=DllCall("RegisterWindowMessage",Str,"SHELLHOOK")
OnMessage(msgnum,"SHELLMESSAGE" )
OnMessage(0x404,"TRAYMESSAGE")
OnMessage(0x200,"WM_MOUSEMOVE")
OnExit,EXIT
Return


MENU:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,%applicationname%,SEND
Menu,Tray,Default,%applicationname%

Menu,Tray,Add
stamps=0
Loop,99
{
  IniRead,stamp,%applicationname%.ini,Settings,stamp%A_Index%
  If stamp=ERROR
    Continue
  stamps+=1
  stamp%stamps%:=stamp
  string:=stamp
  Gosub,EXPAND

  IniRead,hotkey,%applicationname%.ini,Settings,hotkey%A_Index%
  If hotkey=ERROR
    hotkey=
  Else
  {
    hotkey%stamps%:=hotkey
    Hotkey,%hotkey%,SEND,On
  }
  Menu,Tray,Add,&%stamps% - %hotkey% - %timestring%,SEND
}

Menu,Tray,Add
WinGetTitle,title,ahk_id %lastactiveid%
If title=
  WinGet,title,ProcessName,ahk_id %lastactiveid%
StringLeft,shorttitle,title,50
If (shorttitle<>title)
 shorttitle.="..."
Menu,Tray,Add,Active window: %shorttitle%,ACTIVATE

Menu,Tray,Add
Menu,Tray,Add,&Settings...,SETTINGS
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,E&xit,EXIT
Menu,Tray,Tip,%applicationname%
Return


ACTIVATE:
WinActivate,ahk_id %lastactiveid%
Return


SEND:
If (A_TimeSinceThisHotkey<100 And A_TimeSinceThisHotkey<>-1)
{
  Loop,%stamps%
  {
    If (hotkey%A_Index%<>A_ThisHotkey)
      Continue
    string:=stamp%A_Index%
    Gosub,EXPAND
    Send,%timestring%
    Break
  }
}
Else
{
  If A_ThisMenuItemPos=1
    Gosub,EXPAND
  Else
  If A_ThisMenuItemPos>2
  {
    menu:=A_ThisMenuItemPos-2
    string:=stamp%menu%
    Gosub,EXPAND
  }
  WinActivate,ahk_id %lastactiveid%
  WinWaitActive,ahk_id %lastactiveid%,,5
  If ErrorLevel=0
  {
    Send,%timestring%
  }
}
Return


SHELLMESSAGE(wParam,lParam)
{
  Global lastactiveid

  If wParam<>4
    Return
  IfWinNotExist,ahk_id %lParam%
    Return
  WinGetClass,class,ahk_id %lParam%
  If class in Shell_TrayWnd
  {
    Gosub,MENU
    Return
  }
  lastactiveid:=lParam
}


TRAYMESSAGE(wParam,lParam)
{
  If lParam In 517
    Gosub,MENU
  Return
}


EXPAND:
StringGetPos,pos,string,"
If pos=0
  timepos=3
else
  timepos=1
StringSplit,timearray,string,"
LOOP1:
  FormatTime,week,,YWeek
  StringRight,week,week,2
  week+=0
  FormatTime,day,,YDay
  FormatTime,longday,,dddd
  StringLower,dllower,longday
  StringLower,dltitle,longday,T
  StringUpper,dlupper,longday 
  FormatTime,shortday,,ddd
  StringLower,dslower,shortday
  StringLower,dstitle,shortday,T
  StringUpper,dsupper,shortday
  FormatTime,longmonth,,MMMM
  StringLower,mllower,longmonth
  StringLower,mltitle,longmonth,T
  StringUpper,mlupper,longmonth 
  FormatTime,shortmonth,,MMM
  StringLower,mslower,shortmonth
  StringLower,mstitle,shortmonth,T
  StringUpper,msupper,shortmonth
  time=timearray%timepos%
  time:=%time%
  If time=
    Goto,NEXT1
  StringReplace,time,time,nl,&&&,All
  StringReplace,time,time,tab,|||,All
  StringReplace,time,time,week,@@@@,All
  StringReplace,time,time,day,@@@,All
  StringReplace,time,time,dddd,!!!!,All
  StringReplace,time,time,Dddd,$!!!,All
  StringReplace,time,time,DDDD,$$$$,All
  StringReplace,time,time,ddd,!!!,All
  StringReplace,time,time,Ddd,$!!,All
  StringReplace,time,time,DDD,$$$,All
  StringReplace,time,time,mmmm,££££,All
  StringReplace,time,time,Mmmm,§£££,All
  StringReplace,time,time,MMMM,§§§§,All
  StringReplace,time,time,mmm,£££,All
  StringReplace,time,time,Mmm,§££,All
  StringReplace,time,time,MMM,§§§,All
  FormatTime,time,,%time%
  StringReplace,time,time,&&&,`n,All
  StringReplace,time,time,|||,%A_Tab%,All
  StringReplace,time,time,@@@@,%week%,All
  StringReplace,time,time,@@@,%day%,All
  StringReplace,time,time,!!!!,%dllower%,All
  StringReplace,time,time,$!!!,%dltitle%,All
  StringReplace,time,time,$$$$,%dlupper%,All
  StringReplace,time,time,!!!,%dslower%,All
  StringReplace,time,time,$!!,%dstitle%,All
  StringReplace,time,time,$$$,%dsupper%,All
  StringReplace,time,time,££££,%mllower%,All
  StringReplace,time,time,§£££,%mltitle%,All
  StringReplace,time,time,§§§§,%mlupper%,All
  StringReplace,time,time,£££,%mslower%,All
  StringReplace,time,time,§££,%mstitle%,All
  StringReplace,time,time,§§§,%msupper%,All
  timearray%timepos%=%time%
NEXT1:
  timepos+=2
If timepos<=%timearray0%
  Goto,LOOP1
timestring=
timepos=1
LOOP2:
  time=timearray%timepos%
  time:=%time%
  timestring=%timestring%%time%
  timepos+=1
If timepos<=%timearray0%
  Goto,LOOP2
Return


SETTINGS:
Run,TimeStamp.ini
Return


ABOUT:
Gui,99:Destroy
Gui,99:Margin,20,20
Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
Gui,99:Font,W700
Gui,99:Add,Text,x+10 yp+10 Bold,%applicationname% v2.1
Gui,99:Font,W400
Gui,99:Add,Text,y+10,Sends user defined times and dates to the active window.
Gui,99:Add,Text,xp y+5,Doubleclick the tray icon to send the last used date and time.
Gui,99:Add,Text,y+10,Use the Settings menu to change the timestamps and hotkeys.

Gui,99:Add,Picture,xm y+20 G1HOURSOFTWARE Icon2,%applicationname%.exe
Gui,99:Add,Text,x+10 yp,For more tools, information and donations, please visit
Gui,99:Font,W700 CBlue
Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
Gui,99:Font,W400 CBlack

Gui,99:Add,Picture,xm y+20 GDONATIONCODER Icon7,%applicationname%.exe
Gui,99:Add,Text,x+10 yp,Please support the contributors at
Gui,99:Font,W700 CBlue
Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
Gui,99:Font,W400 CBlack

Gui,99:Add,Picture,xm y+20 GAUTOHOTKEY Icon6,%applicationname%.exe
Gui,99:Add,Text,x+10 yp,This tool was made using the powerful
Gui,99:Font,W700 CBlue
Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
Gui,99:Font,W400 CBlack

Gui,99:Show,,%applicationname% - About
hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
Gui,99:+LastFound
aboutid:=WinExist()
Return

1HOURSOFTWARE:
Run,www.1HourSoftware.com
Return

DONATIONCODER:
Run,www.DonationCoder.com
Return

AUTOHOTKEY:
Run,www.AutoHotkey.com
Return


WM_MOUSEMOVE(wParam,lParam)
{
  Global hCurs
  Global aboutid
  MouseGetPos,,,mwin,mctrl
  If mwin in %aboutid%
  If mctrl in Static8,Static11,Static14
    DllCall("SetCursor","UInt",hCurs)
  Return
}

99GuiEscape:
99GuiClose:
  Gui,99:Destroy
  OnMessage(0x200,"")
  DllCall("DestroyCursor","Uint",hCurs)
Return


EXIT:
  DllCall("DeregisterShellHookWindow",UInt,guiid)
  ExitApp


INIFILE:
IfNotExist,%applicationname%.ini
  FileAppend,
(
[Settings]
stamp1=H:mm:ss" - "dddd" "d.MM.yyy" - d"day" w"weeknl
hotkey1=F1
stamp2=yyy.MM.d" "tabH:mm:ss
hotkey2=F2

;TimeStamp.ini
;
;Hotkeys
;^=Ctrl !=Alt +=Shift #=Window
;
;Examples:
;
;^F1=Ctrl-F1
;+!j=Shift-Alt-j
;
;
;Formatting (case sensitive)
;
;nl   NewLine
;tab  Tab
;     Surround regular text with ""
;
;Date Formats (case sensitive)
;
;d    Day of the month without leading zero (1 - 31)
;dd   Day of the month with leading zero (01 – 31)
;ddd  Lowercase abbreviated name for the day of the week (e.g. mon)
;Ddd  Like ddd, but Titlecase
;DDD  Like ddd, but UPPERCASE
;dddd Lowercase full name for the day of the week (e.g. monday)
;Dddd Like ddd, but Titlecase
;DDDD Like ddd, but UPPERCASE
;M    Month without leading zero (1 – 12)
;MM   Month with leading zero (01 – 12)
;mmm  Lowercase abbreviated month name (e.g. jan)
;Mmm  Like mmm, but Titlecase
;MMM  Like mmm, but UPPERCASE
;mmmm Full month name (e.g. january)
;Mmmm Like mmmm, but Titlecase
;MMMM Like mmmm, but UPPERCASE
;y    Year without century, without leading zero (0 – 99)
;yy   Year without century, with leading zero (00 - 99)
;yyyy Year with century. Example: 2005
;gg   Period/era string for the current user's locale (blank if none)
;Day  Day of the year
;Week Week of the year
;
;Time Formats (case sensitive)
;
;h    Hours without leading zero; 12-hour format (1 - 12)
;hh   Hours with leading zero; 12-hour format (01 – 12)
;H    Hours without leading zero; 24-hour format (0 - 23)
;HH   Hours with leading zero; 24-hour format (00– 23)
;m    Minutes without leading zero (0 – 59)
;mm   Minutes with leading zero (00 – 59)
;s    Seconds without leading zero (0 – 59)
;ss   Seconds with leading zero (00 – 59)
;t    Single character time marker, such as A or P (depends on locale)
;tt   Multi-character time marker, such as AM or PM (depends on locale)
;
;Examples:
;
;H:mm:ss" - "dddd" "d.MM.yyy" - d"day" w"week = 10:49:05 - saturday 14.06.2008 - d166 w24
;yyy.MM.d" "nlH:mm:ss                         = 2008.06.14
;                                               10:49:36
)
,%applicationname%.ini
Return
« Last Edit: June 18, 2008, 03:27 PM by skrommel »

brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
Skrommel.

Thanks for the code. I' imported it into notepad and saved it as  .AHK, but I can't seem to make it work!  The tray Icon appears but Selecting a date or double clicking, or selecting timestamp on the context menu seems to provide no result (nothing in open window (notepad e.g.) and nothing in the clipboard.  What am I missing??????? :'( 
Chuck Brotman

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member
F1 or F2 would do it.

brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
Oooh,

That does seem to work a whole lot better!!!!   :Thmbsup:

see?:  18:29:41 -saturday14.06.2008 - d166 w24

that is exactly what i need even the day and week numbers (which weren't in my original request)

I stand amazed!   (well actually I sit amazed) But, I must say how impressed  I am with the rapid turn around from idea to working code I know you call it one-hour-coding, but I didn't realize you meant it literally....  :greenclp:

Thanks again!  :up: :up: :up: :up: :up:

Chuck
Chuck Brotman
« Last Edit: June 14, 2008, 05:40 PM by brotman »

brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
Hi,

I'm back. theset date pgm works very well thank you! Now, I'd like to distribute it to a computer which does not have the AHK
Program.  I've compiled the .ahk file to an exe. My questions are:
  1) Do I need any permissions from you (skrommel) to redistribute?
  2) Do I need to bring the ini file to  the new PC or does the exe file already contain it?
  3) Any other hints or hints about installing the exe file???


Thanks again,
Chuck
14:24:57 -wednesday18.06.2008 - d170 w25
Chuck Brotman

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :) I've corrected a bunch of errors in the code above!

About redistribution, as long as it's for free, no problem.
The ini file is autogenerated when TimeStamp can't find one, so either edit the code to your liking, or include the ini file.

Skrommel

brotman

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 52
  • Chuck
    • View Profile
    • Donate to Member
Verry cool, Thanks!
Chuck Brotman