iamtheky Posted April 23, 2016 Posted April 23, 2016 I am going through the command list on my win10 box and found get-date, dont know why i never used it prior. #include <array.au3> $sCommand = "powershell Get-Date" $iPID = run($sCommand , "" , @SW_HIDE , $stdout_child) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd ProcessClose($iPID) msgbox(0, '' , $sOutput) $aOut = stringsplit(stringreplace($sOutput , "," , ""), " " , 2) _ArrayTranspose($aOut) _ArrayDisplay($aOut) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Skysnake Posted May 1, 2016 Posted May 1, 2016 The PowerShell command is nice to have, but why use it when you can just use an AutoIt macro? Macro Reference - Time And Date ConsoleWrite(_Now() & @CRLF) Have you tried these? Skysnake Why is the snake in the sky?
iamtheky Posted May 1, 2016 Author Posted May 1, 2016 I like it because with one command you also get day of the week, and if you prefer names to numbers, you dont have to convert month. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
argumentum Posted May 1, 2016 Posted May 1, 2016 (edited) 54 minutes ago, iamtheky said: with one command you also get day of the week, and if you prefer names to numbers #include <Date.au3> Exit ConsoleWrite(@CRLF & @CRLF & f_get_date() & @CRLF & @CRLF) Func f_get_date() Local $sOut = "" $sOut &= _DateDayOfWeek(@WDAY) $sOut &= ", " $sOut &= _DateToMonth(@MON, $DMW_SHORTNAME) $sOut &= " " $sOut &= @MDAY $sOut &= ", " $sOut &= @YEAR $sOut &= " " $sOut &= _Time() Return $sOut EndFunc ;==>f_get_date Func _Time() ; https://www.autoitscript.com/wiki/Snippets_(_Time_%26_Date_)#Time_3 Local $hour = @HOUR, $AMPM = "AM" If $hour > 11 Then $AMPM = "PM" If $hour = 0 Then $hour = 12 If $hour > 12 Then $hour -= 12 Return StringRight("0" & $hour, 2) & ":" & @MIN & ":" & @SEC & " " & $AMPM EndFunc ;==>_Time but I did not know the powershell command. Thanks for posting. Edited May 1, 2016 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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