Leaderboard
Popular Content
Showing content with the highest reputation on 09/18/2021 in all areas
-
Maybe this : #include <GDIPlus.au3> #include <GUIConstants.au3> Global Const $SIZE = 600 Example() Func Example() Local $hGUI = GUICreate("", $SIZE, $SIZE, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) _GDIPlus_Startup() Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($SIZE, $SIZE, $hGraphic) Global $hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGfxCtxt, 2) GUISetState(@SW_SHOW) Local $Xprev = MouseGetPos(0), $Yprev = MouseGetPos(1), $X, $Y, $iPointer = 0 Global $aDraw[400][3] = [[$Xprev, $Yprev, 0xFF]] AdlibRegister(_Fade, 70) While True If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop $X = MouseGetPos(0) $Y = MouseGetPos(1) If $X = $Xprev And $Yprev = $Y Then ContinueLoop $iPointer += 1 If $iPointer = UBound($aDraw) Then $iPointer = 0 $aDraw[$iPointer][0] = $X $aDraw[$iPointer][1] = $Y $aDraw[$iPointer][2] = 0xFF $Xprev = $X $Yprev = $Y WEnd _GDIPlus_GraphicsDispose($hGfxCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Func _Fade() Local $hPen _GDIPlus_GraphicsClear($hGfxCtxt, 0xFFFFFFFF) For $i = 0 to UBound($aDraw) - 1 If $aDraw[$i][2] And $aDraw[Mod($i+1,UBound($aDraw))][2] Then $aDraw[$i][2] -= 51 $hPen = _GDIPlus_PenCreate(Dec(Hex($aDraw[$i][2], 2) & "FF0000", $NUMBER_32BIT), 2) _GDIPlus_GraphicsDrawLine($hGfxCtxt, $aDraw[$i][0], $aDraw[$i][1], $aDraw[Mod($i+1,UBound($aDraw))][0], $aDraw[Mod($i+1,UBound($aDraw))][1], $hPen) _GDIPlus_PenDispose($hPen) EndIf Next _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $SIZE, $SIZE) EndFunc2 points
-
#include <WinAPISys.au3> #include <WinAPIsysinfoConstants.au3> _WinAPI_SystemParametersInfo($SPI_SETMOUSETRAILS, 15, 0, NULL) Change the "15" to 1 or 0 to turn it off Though this is globally, but i'm sure UEZ could come up with a solution in gdiplus.2 points
-
In Wiki Local $g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30) is wrong. Correct is: $g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)1 point
-
WebDriver UDF - Help & Support (III)
seadoggie01 reacted to Danp2 for a topic
Must be a "Chromium" browser thing because it's not in the W3C specs and Geckodriver doesn't work with that endpoint.1 point -
@mLipok There are other strange things in the examples on this page, but they are easy to detect because of the notation : Local $g_idButton2 , etc1 point
-
As I promised, here it is: https://ulozto.net/file/f4RXDYHMtOcP/prospeed-zip https://ulozto.net/file/3UKjU2kfEQ66/prospeed-dll-zip https://ulozto.net/file/UKTdtv6AhY2G/demos-and-sourcecodes-autoit-zip1 point
-
WebDriver UDF - Help & Support (III)
mLipok reacted to seadoggie01 for a topic
Is <URL>/<Port>/sessions an undocumented feature? When calling it, it gets an array of [capabilities, session ids] I wrote a function to test it out and it seems to work fine in Chrome + Edge. I'd find this useful as I often use the same driver for two or more scripts, which makes calling _WD_Shutdown difficult1 point -
Nice script @nine ... allow me just little modification on your listing: #include <GDIPlus.au3> #include <GUIConstants.au3> #include <WINAPI.au3> Global Const $SIZEx = @DesktopWidth, $SIZEy = @DesktopHeight, $AlphaKey = 0xFFFFFFFF Global $hGraphic, $hBitmap, $hGfxCtxt, $aDraw[400][3] Example() Func Example() ; Local $hGUI = GUICreate("", $SIZE, $SIZE, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) Local $hBackground = GUICreate("", $SIZEx, $SIZEy, 0, 0, $WS_POPUPWINDOW, $WS_EX_LAYERED + $WS_EX_TOPMOST) GUISetBkColor($AlphaKey, $hBackground) _WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY) GUISetState(@SW_SHOW, $hBackground) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hBackground) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($SIZEx, $SIZEy, $hGraphic) $hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGfxCtxt, 2) Local $Xprev = MouseGetPos(0), $Yprev = MouseGetPos(1), $X, $Y, $iPointer = 0 ; $aDraw[400][3] = [[$Xprev, $Yprev, 0xFF]] $aDraw[0][0] = $Xprev $aDraw[0][1] = $Yprev $aDraw[0][2] = 0xFF AdlibRegister(_Fade, 70) While True If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop $X = MouseGetPos(0) $Y = MouseGetPos(1) If $X = $Xprev And $Yprev = $Y Then ContinueLoop $iPointer += 1 If $iPointer = UBound($aDraw) Then $iPointer = 0 $aDraw[$iPointer][0] = $X $aDraw[$iPointer][1] = $Y $aDraw[$iPointer][2] = 0xFF $Xprev = $X $Yprev = $Y WEnd _GDIPlus_GraphicsDispose($hGfxCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Func _Fade() Local $hPen _GDIPlus_GraphicsClear($hGfxCtxt, 0xFFFFFFFF) For $i = 1 To UBound($aDraw) - 1 If $aDraw[$i][2] And $aDraw[Mod($i + 1, UBound($aDraw))][2] Then $aDraw[$i][2] -= 51 $hPen = _GDIPlus_PenCreate(Dec(Hex($aDraw[$i][2], 2) & "FF0000", $NUMBER_32BIT), 2) _GDIPlus_GraphicsDrawLine($hGfxCtxt, $aDraw[$i][0], $aDraw[$i][1], $aDraw[Mod($i + 1, UBound($aDraw))][0], $aDraw[Mod($i + 1, UBound($aDraw))][1], $hPen) _GDIPlus_PenDispose($hPen) EndIf Next _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $SIZEx, $SIZEy) EndFunc ;==>_Fade1 point
-
1 point
-
@ThePoroYou'll have to come up with the correct xpath. Have you tried something like this? //div[@data-testid="Tweet"] FWIW, I use the SelectorsHub add-in for determining xpaths.1 point
-
WebDriver UDF - Help & Support (III)
ThePoro reacted to seadoggie01 for a topic
@ThePoro There are lots of ways to build X-Paths, there's no need to include an ID if you don't want to. I'm guessing that you got that X-path by right clicking the Element in the dev console and selecting 'Copy XPath' or something similar. Note that you probably have another entry like "Copy Full XPath", which builds a super literal path to the element. It might look something like this: "/html/body/div[3]/div[2]/div/div/div/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/div/div[2]/div[1]/table/tbody[1]/tr[2]". Ugly, right? Alternately, you can try to build an XPath yourself. Here's a great resource for that: Xpath cheatsheet (devhints.io). Without seeing the full HTML, we can't write one for you, and honestly, I doubt anyone is interested in doing that anyways You might try something like getting a parent's ID and walking down from there, or using something similar to //div[@data-testid="unretweet"] which means "get a div where data-testid is equal to unretweet"1 point -
Here is a reproducer with some 3 files generated one after each other: has 4 pageshas 3 pageshas 4 pages#include "MPDF_UDF.au3" MsgBox(1, "test", "Hit ok to run the first report (4 pages)") FirstPDF() MsgBox(1, "test", "Hit ok to run the second report (3 pages)") SecondPDF() MsgBox(1, "test", "Hit ok to run the third report (4 pages)") ThirdPDF() Func FirstPDF() ;set the properties for the pdf _SetTitle("Demo Table PDF in AutoIt") _SetSubject("Demo Table PDF in AutoIt, with formating") _SetKeywords("pdf, demo, table, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("CUSTOM", 841.890, 595.276); A4 landscape _SetZoomMode($PDF_ZOOM_FULLPAGE) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\table.pdf") ;=== load used font(s) === ;fonts: Garamond _LoadFontTT("_CalibriB", $PDF_FONT_CALIBRI, $PDF_FONT_BOLD) _LoadFontTT("_CalibriI", $PDF_FONT_CALIBRI, $PDF_FONT_ITALIC) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;begin page _BeginPage() _InsertTable(2, 2, 0, 0, 10, 10) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(1) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 0, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(2) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriB", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 20, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(3) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(8, 2, 0, 15, 8, 15) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(5) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriB", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _ClosePDFFile() EndFunc ;==>FirstPDF Func SecondPDF() ;set the properties for the pdf _SetTitle("Demo Table PDF in AutoIt") _SetSubject("Demo Table PDF in AutoIt, with formating") _SetKeywords("pdf, demo, table, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("CUSTOM", 841.890, 595.276); A4 landscape _SetZoomMode($PDF_ZOOM_FULLPAGE) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\table.pdf") ;=== load used font(s) === ;fonts: Garamond _LoadFontTT("_CalibriB", $PDF_FONT_CALIBRI, $PDF_FONT_BOLD) _LoadFontTT("_CalibriI", $PDF_FONT_CALIBRI, $PDF_FONT_ITALIC) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;begin page _BeginPage() _InsertTable(2, 2, 0, 0, 10, 10) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(1) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 0, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(2) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriB", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 20, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(3) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _ClosePDFFile() EndFunc ;==>SecondPDF Func ThirdPDF() ;set the properties for the pdf _SetTitle("Demo Table PDF in AutoIt") _SetSubject("Demo Table PDF in AutoIt, with formating") _SetKeywords("pdf, demo, table, AutoIt") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("CUSTOM", 841.890, 595.276); A4 landscape _SetZoomMode($PDF_ZOOM_FULLPAGE) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\table.pdf") ;=== load used font(s) === ;fonts: Garamond _LoadFontTT("_CalibriB", $PDF_FONT_CALIBRI, $PDF_FONT_BOLD) _LoadFontTT("_CalibriI", $PDF_FONT_CALIBRI, $PDF_FONT_ITALIC) _LoadFontTT("_Calibri", $PDF_FONT_CALIBRI) ;begin page _BeginPage() _InsertTable(2, 2, 0, 0, 10, 10) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(1) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 0, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(2) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriB", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(2, 8, 20, 0, 8, 5) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(3) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriI", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _BeginPage() _InsertTable(8, 2, 0, 15, 8, 15) $sTit = "Sample pdf table generated with AutoIt" _SetTextRenderingMode(5) _InsertRenderedText((_GetPageWidth() / _GetUnit()) / 2, _GetPageHeight() / _GetUnit() - 1.5, $sTit, "_CalibriB", 32, 100, $PDF_ALIGN_CENTER, 0xbbbbbb, 0x202020) _SetTextRenderingMode(0) _EndPage() _ClosePDFFile() EndFunc ;==>ThirdPDF Func _InsertTable($iX, $iY, $iW = 0, $iH = 0, $iCols = 0, $iRows = 0, $lTxtColor = 0x000000, $lBorderColor = 0xdddddd) Local $iPgW = Round(_GetPageWidth() / _GetUnit(), 1) Local $iPgH = Round(_GetPageHeight() / _GetUnit(), 1) If $iW = 0 Then $iW = $iPgW - $iX - 2 If $iH = 0 Then $iH = $iPgH - $iY - 2 _SetColourStroke($lBorderColor) _Draw_Rectangle($iX, $iY, $iW, $iH, $PDF_STYLE_STROKED, 0, 0xfefefe, 0.01) _SetColourStroke(0) Local $iColW = $iW / $iCols Local $iRowH = $iH / $iRows Local $lRGB For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 If $i = 0 Then $lRGB = 0xefefef Else $lRGB = 0xfefefe EndIf _SetColourStroke($lBorderColor) _Draw_Rectangle($iX + $j * $iColW, $iY + $iH - ($i + 1) * $iRowH, $iColW, $iRowH, $PDF_STYLE_STROKED, 0, $lRGB, 0.01) _SetColourStroke(0) Local $sText = "Row " & $i & ": Col " & $j Local $sLength = Round(_GetTextLength($sText, "_Calibri", 10), 1) $lScale = Ceiling(0.75 * $iColW * 100 / $sLength) _SetColourFill($lTxtColor) _SetTextHorizontalScaling($lScale) _DrawText($iX + $j * $iColW + $iColW / 10, $iY + $iH - ($i + 1) * $iRowH + ($iRowH - 10 / _GetUnit()) / 2, $sText, "_Calibri", 10, $PDF_ALIGN_LEFT, 0) _SetTextHorizontalScaling(100) _SetColourFill(0) Next Next EndFunc ;==>_InsertTable Check your script for $a variable. This part is not related with the UDF. Regards, taietel [EDIT] Just to be safe, modify the end of the _ClosePDFFile function to look like this (to clean ALL the resources): Func _ClosePDFFile() ......................... $_Pages = "" $_sPage = "" $_sFONT = "" $_Image = "" $_sObject = "" $_iResource = "" $_Buffer = "" If $_bOpen Then ShellExecute($PDF_NAME) EndFunc ;==>_ClosePDFFile1 point