Leaderboard
Popular Content
Showing content with the highest reputation on 09/13/2021 in all areas
-
Create PDF from your application
felix12123 reacted to taietel for a topic
If you look to output PDF's from your application (generate reports, graphics, tables etc), this UDF can be very useful. In the zip file are examples, images for testing and the UDF. Enjoy! I have removed some of the previous versions due to the lack of space, but they are still available on request. [uPDATED June 22] v.1.0.1 Added more page formats, two more fonts, example table ... [uPDATED July 30] v1.0.2 Solved issues with Adobe Reader. StuffByDennis added two more functions (Thanks Dennis). [uPDATED August 10] v1.0.3 Rewrote entirely _LoadResImage function - optimize for speed/size of the pdf. Fixed the Example_Image2PDF Thanks to xavierh for finding a missing space in the _LoadFontTT function (even it looks insignificant, that solved an issue with text justification when using Adobe Reader, not Foxit Reader) Total downloads old versions: 2044 + 21 Version 1.0.3: MPDFv103.zip1 point -
Getting Title of URL with _INetGetSource
Leendert-Jan reacted to Gianni for a topic
_StringBetween returns an array.... MsgBox(0, "Title", $data[0])1 point -
Request for help on Autoit script on PDF-XChange Editor
seadoggie01 reacted to Musashi for a topic
For me this somehow implies, that you can specify the file format in which the data are available by yourself. Could you please describe in more detail, where e.g. the data you want to extract originates from.1 point -
OK if you and your users can cope with what it means and also what it doesn't say. I'm with you in that I'd rather use the explicit P1Y2M10DT2H30M05S formatfor processing purpose. Human eyes + brains work differently!1 point
-
?? ; https://www.autoitscript.com/forum/topic/111608-window-always-on-bottom/?do=findComment&comment=782930 ; https://www.autoitscript.com/forum/topic/104080-open-winow-in-background/?do=findComment&comment=736679 #include <WinAPI.au3> $PID = Run("notepad.exe", "", @SW_HIDE) ; run notepad $handle = _GetHwndFromPID($PID) ; get its handle ; set the parent to the desktop window so when you shownoactivate it is behind all other windows. $origParent = DllCall("user32.dll", "int", "SetParent", "hwnd", $handle, "hwnd", WinGetHandle("Program Manager")) ; shownoactivate the window (notepad) ; it will stay behind all other windows even when you drag it around _WinAPI_ShowWindow($handle, @SW_SHOWNOACTIVATE) ; $origParent2 = DllCall("user32.dll", "int", "SetParent", "hwnd", $handle, "hwnd", $origParent[0]) ; https://www.autoitscript.com/forum/topic/86680-pid-window-handle-hwnd-conversion/?do=findComment&comment=621521 Func _GetHwndFromPID($PID) $hWnd = 0 $stPID = DllStructCreate("int") Do $winlist2 = WinList() For $i = 1 To $winlist2[0][0] If $winlist2[$i][0] <> "" Then DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID)) If DllStructGetData($stPID, 1) = $PID Then $hWnd = $winlist2[$i][1] ExitLoop EndIf EndIf Next Sleep(100) Until $hWnd <> 0 Return $hWnd EndFunc ;==>_GetHwndFromPID1 point
-
Skysnake, Please see this post of mine. M231 point
-
If you want the difference between two dates expressed in years, months, days, hours, minutes and seconds, this little _ElapsedTime() function can be useful for you. It returns an array with those results in its elements, that you can then format as you better like... (maybe it can be shorten a bit) (something similar already diascussed here.... https://www.autoitscript.com/forum/topic/206014-autoit-calculates-date/?do=findComment&comment=1483698) #include <Date.au3> Local $Start = "2020/01/01 08:00:00" ; "1962/05/02" & " " & "00:00:00" ; _NowTime(); start date Local $Stop = "2021/09/05 15:58:00" ; _NowCalc() ; _NowCalcDate() ; end date Local $aElapsed = _ElapsedTime($Start, $Stop) ; MsgBox(0, "Elapsed Time", $aElapsed[0] & " years, " & $aElapsed[1] & " months, " & $aElapsed[2] & " days, " & $aElapsed[3] & " hours, " & $aElapsed[4] & " minutes, " & $aElapsed[5] & " seconds") ConsoleWrite("Elapsed Time from " & $Start & " to " & $Stop & " : " & $aElapsed[0] & " years, " & $aElapsed[1] & " months, " & $aElapsed[2] & " days, " & $aElapsed[3] & " hours, " & $aElapsed[4] & " minutes, " & $aElapsed[5] & " seconds" & @CRLF) ; returns an array with the elapsed time between 2 dates expressed in years, months, days, hours, minutes, seconds Func _ElapsedTime($sStartDate, $sEndDate) Local Enum $iYears, $iMonths, $iDays, $iHours, $iMinutes, $iSeconds Local $aResult[6] ; $aResult[$iYears] = _DateDiff('Y', $sStartDate, $sEndDate) $aResult[$iMonths] = _DateDiff('M', _DateAdd('Y', $aResult[$iYears], $sStartDate), $sEndDate) $aResult[$iDays] = _DateDiff('D', _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate)), $sEndDate) $aResult[$iHours] = _DateDiff('h', _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate))), $sEndDate) $aResult[$iMinutes] = _DateDiff('n', _DateAdd('h', $aResult[$iHours], _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate)))), $sEndDate) $aResult[$iSeconds] = _DateDiff('s', _DateAdd('n', $aResult[$iMinutes], _DateAdd('h', $aResult[$iHours], _DateAdd('D', $aResult[$iDays], _DateAdd('M', $aResult[$iMonths], _DateAdd('Y', $aResult[$iYears], $sStartDate))))), $sEndDate) Return $aResult ; [0] years; [1] months; [2] days; [3] hours; [4] minutes; [5] seconds EndFunc ;==>_ElapsedTime1 point
-
The standard for date format is ISO-8601, which also specifies how to espress durations. For instance, year 0000 doesn't exist which makes your output an invalid ISO-8601date string! To see what makes dates and durations differ, consider a similar question. I give you two points in 3D space by their coordinates in some base. The 2 points are then well defined and so is the length of the segment joining them. Now I ask you to compute that length expressed in the input format, that is in 3D coordinates and ... you tell Houston you have a problem. Theses formats differ by nature and properties, you can't apply the input format to the output. You have to express the fact that the output is a period, that is prepend 'P' to the output format. See https://en.wikipedia.org/wiki/ISO_8601#Durations Add to this fundamental problem the variability of a month (is that 28, 29, 30 or 31 days?) and of a year (is that 365 or 366 days?): this output date format looses its meaning and, if using the period format, it looses precision. Periods beyond days, hours and seconds are approximate at best. The ISO-8601date format is very practical, thanks to its human-readability, un-ambiguousness and self-collating property. It's not even a 6D vector (Y, M, D, h, m, s) since year, month and day are not independant coordinates. But it can't express durations or time periods in the general case unless you use the 'P' format and accept its fuzzy meaning. Things would be different if your input was in Julian date format: a Julian date is a real >= 0.0 and is in fact a Julian period from the start of the conventional Julian calendar. The difference between two Julian dates is then also a period, hence expressable in Julian date format. See AutoIt _DateToDayValue() and _DayValueToDate() functions albeit they don't handle fractional days (hms are unfortunately ignored).1 point
-
@Viszna welcome, I think your problem is discussed here: https://dba.stackexchange.com/questions/47131/how-to-get-rid-of-maximum-user-connections-error I do not know how to terminate your MySQL server side connection. The server is probably keeping your connection open (for a limited time) after you have closed it on your side. Also look at connection pooling? Your suggestion of opening one connection and running all queries on that for the day, may be the quickest solution. But this is not guaranteed to provide a long term solution. S1 point