stiv Posted April 27, 2022 Posted April 27, 2022 Hello autoit companions, Could you help me with something basic that shows today, for example (Monday, Tuesday, Wednesday, etc) I have not interpreted the documentation correctly Thank you I attach my code Local $sNewDate , $sLongDayName , $sCurrentDate $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $sNewDate = _DateAdd('d', 0, $sCurrentDate) ; current date + 2 days $sLongDayName = _DateDayOfWeek ( $sNewDate, 2 ) MsgBox ( 4096 , "" , "DAY IS : " & $sNewDate & " " & $sLongDayName ) but it shows me the date and not the day
Danp2 Posted April 27, 2022 Posted April 27, 2022 You need to convert the date into the day of week before calling _DateDayOfWeek -- $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $sNewDate = _DateAdd('d', 0, $sCurrentDate) ; current date + 2 days $aYMD = StringSplit($sNewDate, "/", 2) $iWeekday = _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]) $sLongDayName = _DateDayOfWeek ( $iWeekday, $DMW_LOCALE_LONGNAME) MsgBox ( 4096 , "" , "DAY IS : " & $sNewDate & " " & $sLongDayName) Latest Webdriver UDF Release Webdriver Wiki FAQs
Developers Jos Posted April 27, 2022 Developers Posted April 27, 2022 Moved to the appropriate forum. Moderation Team stiv 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
stiv Posted April 27, 2022 Author Posted April 27, 2022 (edited) @ Danp2 error de muestra Edited April 27, 2022 by stiv
Nine Posted April 27, 2022 Posted April 27, 2022 What version of AutoIt do you have ? Most likely, you would need to DL latest version... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
stiv Posted April 27, 2022 Author Posted April 27, 2022 @Nineupdate to the latest version, 3.3.16.0 and shows the following error
Solution Danp2 Posted April 27, 2022 Solution Posted April 27, 2022 #include <Date.au3> Local $sNewDate, $sLongDayName, $sCurrentDate, $aYMD, $iWeekday $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $sNewDate = _DateAdd('d', 0, $sCurrentDate) ; current date + 2 days $aYMD = StringSplit($sNewDate, "/", 2) $iWeekday = _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]) $sLongDayName = _DateDayOfWeek ( $iWeekday, $DMW_LOCALE_LONGNAME) ConsoleWrite( "DAY IS : " & $sNewDate & " " & $sLongDayName & @CRLF) The above runs fine for me with both 3.3.14.5 and 3.3.16.0 versions of Autoit. Can you run this exact code and then post the Scite output panel results? FYI, they should look like this if you are running the full version of Scite -- >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\danpo\Downloads\test.au3" /UserParams +>16:08:47 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000409 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\danpo\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\danpo\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\danpo\Downloads\test.au3 +>16:08:47 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\danpo\Downloads\test.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. DAY IS : 2022/04/27 Wednesday +>16:08:47 AutoIt3.exe ended.rc:0 +>16:08:47 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.9807 Latest Webdriver UDF Release Webdriver Wiki FAQs
Musashi Posted April 27, 2022 Posted April 27, 2022 33 minutes ago, stiv said: What version do you have? Runs fine for me with AutoIt 3.3.14.0 #include <Date.au3> $sCurrentDate = _NowCalcDate() ; current date in format YYYY/MM/DD $aYMD = StringSplit($sCurrentDate, "/", 2) $iWeekday = _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]) $sLongDayName = _DateDayOfWeek ( $iWeekday, $DMW_LOCALE_LONGNAME) MsgBox ( 4096 , "" , "DAY IS : " & $sCurrentDate & " " & $sLongDayName) stiv 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
stiv Posted April 28, 2022 Author Posted April 28, 2022 @Musashi and @Danp2 Thank you very much fellow autoit
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