2

I'd like to know if its possible in Windows for a script (or similar) to be written that will copy today's date and specific text into the clipboad, in the following format:

dd/mm/yy - xx - xxx

example

22/12/13 - JS - test note

Also, would like to then know how this script can be: a) set to run on startup b) assigned to a specific keyboard shortcut

Thanks in advance

1

Sure its possible, an easy especially with say PowerShell, or even C# or VB.Net.

A simple PowerShell Script to do as you ask:

$curDate = Get-Date -Format "dd/MM/yy"
$curDate + "JS - Test Note" | clip

If I paste out my results:

21/12/13JS - Test Note

Now you just need to figure out how you actually want to use it. If on Startup, just add a startup item that calls PowerShell and pipes in the correct .ps1 script.

If you want a hotkey, best bet is to look at something like AutoHot keys. Writing this your self can be a challenge, or caught by Windows as Malware.

|improve this answer|||||
  • 1
    Thanks for your answer, and for introducing me to AutoHotKeys. It was perfect for what I needed (automating scripts and hotkeys for the team at work) and allows compiling into exe's so the team don't need anything fancy installed. I have now written my first script! No issues with malware :) thanks again – mothman11 Dec 26 '13 at 12:15
  • In a PowerShell script it would be better to use Set-Clipboard ($curDate + "JS - Test Note") instead of piping the string to clip since the latter would lead to false results if the string contains special characters like Ä. – Bill Tür Jun 24 '19 at 10:56
  • @ThomasSchremser "False results"? Additionally before PS ~5 I believe clip.exe was the way to get this done. (7 year old answer) – Austin T French Jun 24 '19 at 12:11
  • I'm aware the answer is 7 years old, and IMO still a good one. That said, "false results" was probably poorly worded. What I mean is that if i run "Täst" | clip on my system the clipboard then contains Tõst. I couldn't find out quickly when Set-Clipboard was introduced. – Bill Tür Jun 24 '19 at 12:21
1

Yes, it is possible, for example in C#.

It might even be easier using AutoHotKey

|improve this answer|||||
  • 1
    Thanks for your answer. Because you and the previous answer mentioned autohotkeys, i checked it out and turned out to be perfect for what i needed. Have now written my first script, thanks :) – mothman11 Dec 26 '13 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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