evilpacketmonkey Posted March 31, 2009 Posted March 31, 2009 Goal: Create a file with the current (local) time as a part of the name. Problem is time and date outputs use illegal characters "/" and ":". Example: Project_03_30_2009_17_52_10.txt I cobbled some code together by using the "search" tool and the help file. The question is, there is a better way to do this right? #include <Date.au3> Dim $tSystem, $tLocal, $TimeDate, $LocalArrayDate, $LocalArrayTime, $TimeDate, $LocalDateForFile, $Combined_DateTime_ForFile Dim $LocalDateForFile, $LocalTimeForFile _SystemTimeToLocalTimeArray() Func _SystemTimeToLocalTimeArray() $tSystem = _Date_Time_GetSystemTime() $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem)) $TimeDate = StringSplit(_Date_Time_SystemTimeToDateTimeStr($tLocal), ' ', 1) $LocalArrayDate = StringSplit($TimeDate[1], '/', 1) $LocalDateForFile = $LocalArrayDate[1] & "_" & $LocalArrayDate[2] & "_" & $LocalArrayDate[3] $LocalArrayTime = StringSplit($TimeDate[2], ':', 1) $LocalTimeForFile = $LocalArrayTime[1] & "_"& $LocalArrayTime[2] & "_" & $LocalArrayTime[3] Global $Combined_DateTime_ForFile = "_" & $LocalDateForFile & "_" & $LocalTimeForFile EndFunc MSGBOX(0, "Title", $Combined_DateTime_ForFile)
Ascend4nt Posted March 31, 2009 Posted March 31, 2009 All you need are macros.. @YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
evilpacketmonkey Posted March 31, 2009 Author Posted March 31, 2009 All you need are macros..@YEAR,@MON,@MDAY,@HOUR,@MIN,@SEC..ahh cool thanks. I knew it had to be something simple but I guess I was not seeing the forest through the tree's. My bad.Thanks for your help.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now