ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: AHK script to insert date and time to file name

<< < (2/4) > >>

wetsmellydog:
I use this - prune it how you like.
Having the date in ISO format at the front of the file name makes for good document filing/sorting.

AutoHotKey script:
^+d::  ; Ctrl+Shift+d outputs current date+time
   FormatTime, CurrentDateTime,, yyyy-MM-dd HHmm  ; It will look like 2010-12-21 0353hrs
   SendInput %CurrentDateTime%hrs
   return

--- End quote ---
-IainB (June 25, 2010, 12:26 PM)
--- End quote ---

Sweet!  :Thmbsup:

Thanks! Hopefully I will have more time to work on learning AHK to be able to know that it takes a whole two lines of code to do this!

BTW works like a charm.

IainB:
@wetsmellydog: Thanks for your thanks. I cannot take credit for this as being "all my own work" though!

I actually lifted some AHK code from somewhere else (I forget where), and then later - after taking the time to discover/learn more about AHK - I simplified and modified the code to suit my particular requirements. So what you see is what I ended up with.

The sources I used were:

* http://www.autohotkey.com/
* http://www.autohotkey.com/forum/
* http://www.autohotkey.com/wiki/index.php?title=Main_Page
* + some of the AHK scripts in the DC website and forum
These are all good. The tutorials I came across were very helpful.

As an encouragement, I would suggest that you might pick it up quite quickly if you have no techo background to cloud your thinking with preconceptions.

You might think it would help to have a techo background, but sometimes I am not so sure.

For example, take my case: Having been introduced to computer programming via a low-level programming language used for assembler programming on mainframe computers years ago, I have always had difficulty changing my thinking to use any higher-level languages. It was thus difficult for me when I later had to adapt and learn to program in the programming language FORTRAN (which has to be compiled before execution), but when I learned the BASIC language it seemed quite foreign (it is not compiled, but runs through an interpreter at run-time). Years later, I had similar difficulty wrapping my mind around a scripting language (I think it was called "Telix") to control and manipulate data flowing between the PC serial port and a modem (driven by the Hayes AT command set).
So, when I came across AHK, though it at least had a degree of familiarity in its general structure, I had to push to one side everything that I had previously learned, lest it get in the way of my understanding this new thing.

You might not have that difficulty, from the sound of things.
Interestingly, from what I have read, a lot of the PC viruses over the years are apparently thought to have been developed by "script-kiddies" - virgins whose first PC programming language was a scripting language.

wetsmellydog:
IainB "As an encouragement, I would suggest that you might pick it up quite quickly if you have no techo background to cloud your thinking with preconceptions."

No truer words were ever spoken!

I am an electronics engineer by trade and now a nurse. My specialty was automation and controls.

It has been tough to wrap my mind around how they want "nurses" to think. What seems simple to the people who do not have a technical background take on a whole new meaning to me.   :huh:

I am far ahead of what they are expecting and I have to remember to go from a to b to c instead of jumping right into c because I "know" it is right. I have also been working in the medical field for the last 4 years which also hinders that KISS thinking.

Some of us think in binary and some of us think in analog and some of us keep confusing the 10!!

metaDCoder:
Hi, I wonder if you could maybe mod this:

--- ---^+d::  ; Ctrl+Shift+d outputs current date+time
   FormatTime, CurrentDateTime,, yyyy-MM-dd HHmm  ; It will look like 2010-12-21 0353hrs
   SendInput %CurrentDateTime%hrs
   return

So that it would rather copy to the clipboard the ISO formatted timestamp as given by attributes/properties (rather than CURRENT timestamp).

Thanks

IainB:
You'd be able to use AHK FileGetTime for that:
From the Help file:
Parameters

* OutputVar: The name of the variable in which to store the retrieved date-time in format YYYYMMDDHH24MISS. The time is your own local time, not UTC/GMT.
* Filename: The name of the target file or folder, which is assumed to be in %A_WorkingDir% if an absolute path isn't specified. If omitted, the current file of the innermost enclosing File-Loop will be used instead.
* WhichTime: Which timestamp to retrieve:
M = Modification time (this is the default if the parameter is omitted)
C = Creation time
A = Last access time

I haven't used it in an AHK script, but it should presumably work fine.
First, you'd need to decide which of the three file date/times you wanted to retrieve by default - M, C, or A.
The new bit for me would be pinpointing the input file from which to take the date/time.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version