Jump to content

ces1a

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ces1a's Achievements

Seeker

Seeker (1/7)

2

Reputation

  1. ;This script will calculate the Nth weekday of any month. Just replace the numbers for $Year, $Month, $Week, and $Weekday with numbers of your choice, ;Some lines are not really needed but are there to allow testing and proofing. It is based on Excel formula. #include <Date.au3> Global $tmp, $Year = "2019", $Month = "2", $Week = 2, $WeekDay = 4 Global $aNth = StringSplit("First ,Second ,Third ,Fourth ,Fifth ", ",") Func GetWeekDay($Week, $Year, $Month, $WeekDay) Local $LastDay = 8 - $WeekDay, $EndDay = $Week * 7 + 1 $Month = $Month > 10 ? $Month : "0" & $Month Local $iWday = _DateToDayOfWeek($YEAR, $Month, $LastDay) Return $YEAR & "/" & $Month & "/" & $EndDay - $iWday EndFunc MsgBox(0,'',$aNth[$Week] & _DateDayOfWeek($WeekDay) & " of " & _DateToMonth($Month) & _ " " & $Year & " is " & GetWeekDay($Week, $Year, $Month, $WeekDay) ) GetNthWeekDay.au3
  2. This is an easy way to get the number of days between today and any future date without having to acount for Hours, Minutes, and Seconds. #include <Date.au3> Func ShowDays($FutureDate) $iDaysDiff = _DateDiff('D', _NowCalcDate(), $FutureDate) If $iDaysDiff < 1 Then Return 0 ;Insure only positive return Return $iDaysDiff EndFunc ;==GoPR MsgBox(0, '', ShowDays("2017/07/31")) I use it to know how many days till I go on my next vacation. Maybe one of you can find a use for it.
  3. Thanks for the info, BetaLeaf, but what I needed in my case is to run a program when my computer starts. The program has to wait 3 minutes from the time the laptop started to run two programs so as not to slow Windows startup in any way. Getting the System Uptime had to take place automatically. This way when the computer has been running close to three minutes my script runs two of my other programs.
  4. Thanks a lot to everyone. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_HiDpi=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** The above lines seem to make my executable unable to run. I have not figured out why yet. DllCall("User32.dll","bool","SetProcessDPIAware") Lets my script run but causes distortion to my labels, However, looks like this is the right direction to go. Thanks a million...
  5. Here is a sample of what some replies are referring you to: You merely pass the month and year to _DateDaysInMonth( ) and it returns the last day for that month. #include <Date.au3> MsgBox(0, '', _DateDaysInMonth(2016, 5))
  6. I recently upgraded my laptop to one with Windows 10 and higher screen resolution. In the process I found that some of my scripts did not work right when using Autoit's @DesktopWidth and @DesktopHeight macros. Insteat of 1920 x 1080 resolution Autoit detects 1536 x 864. Thus, GUIs designed to appear near the right edge of the screen displayed closer to the horizontal middle of the screen. I assume others may have the same problem. A search on this forum and Microsoft Script Center helped me to write the following script that gets the true screen width and height from WMI. MsgBox(0, '', _GetMonitorInfo()) Func _GetMonitorInfo() Local $oWMI, $Listing, $sWidth = 0, $sHeight = 0 $oWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") If IsObj($oWMI) Then $Listing = $oWMI.ExecQuery("SELECT * FROM Win32_DesktopMonitor") If IsObj($Listing) Then For $oItem In $Listing $sHeight = $oItem.ScreenHeight $sWidth = $oItem.ScreenWidth Next EndIf EndIf Return "Width: " & $sWidth & @CRLF & "Height: " & $sHeight EndFunc ;_GetMonitorInfo Hopefully it will benefit others. I for sure am very happy with all the samples I been able to find here in the past.
  7. You are right about the limitations of the method but if you modify it as follows it works. #include <WinAPISys.au3> #include <WinAPIMisc.au3> Local $Uptime = _WinAPI_StrFromTimeInterval(_WinAPI_GetTickCount64()) MsgBox(0, '', "PC Uptime ==> " & $UpTime) The only difference is the line: Local $Uptime = _WinAPI_StrFromTimeInterval(_WinAPI_GetTickCount()) Is changed to: Local $Uptime = _WinAPI_StrFromTimeInterval(_WinAPI_GetTickCount64()) Thanks for your input.
  8. I was looking for a way to find out how long my PC had been running a few weeks ago and had trouble finding something that satisfied my needs, I found a Visual Basic Script that worked but found it too long. But searching trough AutoIt WINAPI help found that it really was as simple as the following little script. #include <WinAPISys.au3> #include <WinAPIMisc.au3> Local $Uptime = _WinAPI_StrFromTimeInterval(_WinAPI_GetTickCount()) MsgBox(0, '', "PC Uptime ==> " & $UpTime) Hope it helps...
×
×
  • Create New...