7

I am looking to write/build (or download a freeware application that fulfills the need I have expressed) an application that would run in the notification area and that, when clicked, would send a timestamp string in the form "yyyy-mm-dd--hh-mm-ss" to the clipboard.

I would use this to add 'hard' metadata (that is, metadata that is a part of the filename) to my files.

LaTeX is the extent of my programming (authoring, actually) knowledge, so...I might need some, um, handholding if I'm to make an app to do this. Would I be using Visual Studio?

  • I am running Windows 8.1 Pro 64-bit on an HP ENVY Sleekbook 4 PC
  • I have access to Visual Studio; I don't, however, currently have it installed.

References:

  1. What is your favorite date and time format in a file name? [closed]
  2. “Standard” format for using a timestamp as part of a filename
  3. Generate unique file name with timestamp in batch script
2
  • Is Java fine for your setup? If so, I might just code that. Its not difficult. Feb 21, 2014 at 23:05
  • Though your description holds several criteria required to recommend matching software, it suffers some formatting issues to make them clearly stand out. Please take a look at What is required for a question to contain "enough information"? Then please edit your question and see if you can incorporate some of these improvements. This will significantly improve your chances of good answers!
    – Izzy
    Feb 22, 2014 at 19:08

1 Answer 1

1

TimeCopier

Now there is such a script written by me using PowerShell.

System requirements:

  • Windows
  • PowerShell 3 (shipped natively with Windows 8)

Screenshot

Screenshot of the system tray showing the notification icon of my program

Example clipboard contents: 2014-08-18--18-00-45

Installation

Download the full code at https://github.com/ComFreek/TimeCopier

An excerpt of the README provided in the GitHub repository mentioned above.

  1. Run PowerShell as an administrator and run the following command:

    Set-ExecutionPolicy RemoteSigned
    
  2. Start manage-autostart.ps1 if you would like TimeCopier to start every time you login to your Windows account.

  3. Replace icon.ico if you would like to change the notification icon.

Code (for the archive)

I only include the main file for brevity. It can be run via powershell -windowstyle hidden -noexit "filename.ps1". It uses a file called icon.ico in the same directory as the PowerShell file for the script's notification icon. This icon file must be provided.

[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

function Copy-Date {
    $date = Get-Date -Format "yyyy-MM-dd--HH-mm-ss"
    [Windows.Forms.Clipboard]::SetText("$date")
}

function Init-Gui {
    $NotifyIcon = New-Object System.Windows.Forms.NotifyIcon
    $NotifyIcon.Icon = New-Object System.Drawing.Icon(Join-Path $PSScriptRoot "icon.ico")
    $NotifyIcon.Visible = $True

    Register-ObjectEvent -MessageData ${function:Copy-Date} -InputObject $NotifyIcon -EventName Click -Action {
            $Event.MessageData.Invoke()
            $Sender.ShowBalloonTip(250, "Success", "Date & Time copied!", [System.Windows.Forms.ToolTipIcon]::Info);
    } | Out-Null
}
Init-Gui

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.