Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/16/2021 in all areas

  1. May be this ? Func _GUICtrlListView_ClickItemMod($hWnd, $iIndex, $sButton = "left", $bMove = False, $iClicks = 1, $iSpeed = 1) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) _GUICtrlListView_EnsureVisible($hWnd, $iIndex, False) Local $tRECT = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $LVIR_LABEL) Local $tPoint = _WinAPI_PointFromRect($tRECT, True) $tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint) Local $iX, $iY _WinAPI_GetXYFromPoint($tPoint, $iX, $iY) Local $tCtrl = _WinAPI_GetWindowInfo($hWnd) $iX = DllStructGetData($tCtrl, 'rClient', 1) + 4 Local $iMode = Opt("MouseCoordMode", 1) If Not $bMove Then Local $aPos = MouseGetPos() _WinAPI_ShowCursor(False) MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed) MouseMove($aPos[0], $aPos[1], 0) _WinAPI_ShowCursor(True) Else MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed) EndIf Opt("MouseCoordMode", $iMode) EndFunc ;==>_GUICtrlListView_ClickItemMod
    2 points
  2. You could wrap a function around like this : #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include <FontConstants.au3> Example() Func Example() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_CreateEx($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text") GUISetState(@SW_SHOW) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit EndSelect WEnd EndFunc ;==>Example Func _GUICtrlRichEdit_CreateEx($hWnd, $sText, $iLeft, $iTop, $iWidth = 150, $iHeight = 150, $iStyle = -1, $iExStyle = -1) Local $hCtrl = _GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle) If @error Then Return SetError(@error) Local $hFont = _WinAPI_CreateFont(20, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') _SendMessage($hCtrl, $WM_SETFONT, $hFont, True) _WinAPI_DeleteObject($hFont) Return $hCtrl EndFunc Where you would have the definition of the font standardized...
    2 points
  3. The most probable situation is that eBay is detecting the Navigator.webdriver property: It is possible to mask this with some hacks though, here is the JavaScript snippet I used a while ago to mask that in Chrome: Object.defineProperty(Navigator.prototype, "webdriver", {get: Function.prototype.bind()}) You can use this code by injecting it into every page on start like so: ; Inject Navigator Shim Local $sNavShim = 'Object.defineProperty(Navigator.prototype, "webdriver", {get: Function.prototype.bind()})' Local $oParams = Json_ObjCreate() Json_ObjPut($oParams, 'source', $sNavShim) _WD_ExecuteCdpCommand($g_sSession, 'Page.addScriptToEvaluateOnNewDocument', $oParams) But this uses Chrome's non-standard CDP (Chrome DevTools Protocol) protocol (redundant, heh), so obviously it works only in Chrome. Firefox's equivalent is the Marionette protocol, but I am not familiar with it, so someone else would have to help you with that.
    2 points
  4. 2 points
  5. Encryption / Decryption / Hashing / Signing Purpose Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI. Microsoft's CNG is designed to be extensible at many levels and cryptography agnostic in behavior. Although the Crypt.au3 UDF lib that is installed with AutoIt3 still works well, the advapi32.dll functions that it uses have been deprecated. In addition the Crypt.au3 UDF lib, as it is currently written, has a very limited ability to decrypt AES data that was not encrypted using Crypt.au3 functions. That is because Crypt.au3 functions do not allow you to specify an actual key or initialization vector (IV). It only lets you specify data to be used to derive a key and uses a static IV. This UDF was created to offer a replacement for the deprecated functions used by Crypt.au3. According to Microsoft, deprecated functions may be removed in future release. It was also created to allow more flexibility and functionality in encryption/decryption/hashing/signing and to expand the ability for users to implement cryptography in their scripts. Description This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions. It implements functions to encrypt/decrypt text and files, generate hashes, derive keys using Password-Based Key Derivation Function 2 (PBKDF2), create and verify signatures, and has several cryptography-related helper functions. The UDF can implement any encryption/decryption algorithms and hashing algorithms that are supported by the installed cryptography providers on the PC in which it is running. Most, if not all, of the "magic number" values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file. To flatten the learning curve, there is an example file that shows examples of all of the major functionality. This example file is not created to be an exhaustive set of how to implement each feature and parameter. It is designed to give you a template or guide to help you hit the ground running in terms of using the functions. I have tried to fully document the headers of all of the functions as well as the code within the functions themselves. As of v1.4.0, there is also a Help file that includes all of the functions, with examples. Current UDF Functions Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_GCM_EncryptData _CryptoNG_AES_GCM_DecryptData _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_3DES_CBC_DecryptFile Generic Symmetric Encryption/Decryption Functions _CryptoNG_EncryptData _CryptoNG_DecryptData _CryptoNG_EncryptFile _CryptoNG_DecryptFile Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2 Asymmetric (Public/Private Key) Cryptography Functions _CryptoNG_ECDSA_CreateKeyPair _CryptoNG_ECDSA_SignHash _CryptoNG_ECDSA_VerifySignature _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_CreateKeyPairEx _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData _CryptoNG_RSA_SignHash _CryptoNG_RSA_VerifySignature Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version Related Links Cryptography API: Next Generation - Main Page Cryptography API: Next Generation - Reference Cryptography API: Next Generation - Primitives Cryptography API: Next Generation - Cryptographic Algorithm Providers Get CryptoNG from the AutoIt Downloads Area
    1 point
  6. Ever needed C style nested structs, unions or easy pointer references in your DllStruct? Then this may be your solution! It also comes with some quality of life functions for better debugging, like being able to get the original string you used when creating the struct. Download: latest Example: #AutoIt3Wrapper_Change2CUI=Y #NoTrayIcon #include <WinAPIHObj.au3> #include <WinAPIError.au3> #include <WinAPISysWin.au3> #include <WinAPIProc.au3> #include <WinAPIFiles.au3> #include <String.au3> #include "DllStructEx.au3" #include "DllStructEx.debug.au3" #Region Global variables Global Const $tagCONSOLE_CURSOR_INFO = "dword dwSize;int bVisible" Global Const $tagINPUT_RECORD = _ "WORD EventType;"& _ "union {"& _ " KEY_EVENT_RECORD KeyEvent;"& _ " MOUSE_EVENT_RECORD MouseEvent;"& _ " WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;"& _ " MENU_EVENT_RECORD MenuEvent;"& _ " FOCUS_EVENT_RECORD FocusEvent;"& _ "} Event;" Global Const $EventType_FOCUS_EVENT = 0x0010, $EventType_KEY_EVENT = 0x0001, $EventType_MENU_EVENT = 0x0008, $EventType_MOUSE_EVENT = 0x0002, $EventType_WINDOW_BUFFER_SIZE_EVENT = 0x0004 Global Const $tagKEY_EVENT_RECORD = _ "BOOL bKeyDown;"& _ "WORD wRepeatCount;"& _ "WORD wVirtualKeyCode;"& _ "WORD wVirtualScanCode;"& _ "union {"& _ " WCHAR UnicodeChar;"& _ " CHAR AsciiChar;"& _ "} uChar;"& _ "DWORD dwControlKeyState;" Global Const $tagMOUSE_EVENT_RECORD = _ "COORD dwMousePosition;" & _ "DWORD dwButtonState;" & _ "DWORD dwControlKeyState;" & _ "DWORD dwEventFlags;" Global Const $tagCOORD = _ "SHORT X;"& _ "SHORT Y;" Global Const $tagWINDOW_BUFFER_SIZE_RECORD = _ "COORD dwSize;" Global Const $tagMENU_EVENT_RECORD = _ "UINT dwCommandId;" Global Const $tagFOCUS_EVENT_RECORD = _ "BOOL bSetFocus;" Global Const $tagCONSOLE_SCREEN_BUFFER_INFO = _ "COORD dwSize;"& _ "COORD dwCursorPosition;"& _ "WORD wAttributes;"& _ "SMALL_RECT srWindow;"& _ "COORD dwMaximumWindowSize;" Global Const $tagSMALL_RECT = _ "SHORT Left;"& _ "SHORT Top;"& _ "SHORT Right;"& _ "SHORT Bottom;" #EndRegion Global variables #Region Functions Func AllocConsole() Local $aRet = DllCall("kernel32.dll", "BOOL", "AllocConsole") If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func FreeConsole() Local $aRet = DllCall("kernel32.dll", "BOOL", "FreeConsole") If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func IsDebuggerPresent() Local $aRet = DllCall("kernel32.dll", "BOOL", "IsDebuggerPresent") If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func SetConsoleMode($hConsoleHandle, $dwMode) Local $aRet = DllCall("kernel32.dll", "BOOL", "SetConsoleMode", "HANDLE", $hConsoleHandle, "DWORD", $dwMode) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func SetStdHandle($nStdHandle, $hHandle) ;returns BOOL ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686244%28v=vs.85%29.aspx Local $aRet = DllCall("kernel32.dll", "BOOL", "SetStdHandle", "DWORD", $nStdHandle, "HANDLE", $hHandle) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func CreateFile($lpFileName, $dwDesiredAccess, $dwShareMode, $lpSecurityAttributes, $dwCreationDisposition, $dwFlagsAndAttributes) Local $aResult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $lpFileName, "dword", $dwDesiredAccess, "dword", $dwShareMode, "struct*", $lpSecurityAttributes, "dword", $dwCreationDisposition, "dword", $dwFlagsAndAttributes, "ptr", 0) If @error Or ($aResult[0] = Ptr(-1)) Then Return SetError(@error, @extended, 0) ; $INVALID_HANDLE_VALUE Return $aResult[0] EndFunc Func GetConsoleCursorInfo($hConsole, $lpConsoleCursorInfo) Local $aRet = DllCall("kernel32.dll", "BOOL", "GetConsoleCursorInfo", "hwnd", $hConsole, "STRUCT*", $lpConsoleCursorInfo) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func SetConsoleCursorInfo($hConsole, $lpConsoleCursorInfo) Local $aRet = DllCall("kernel32.dll", "BOOL", "SetConsoleCursorInfo", "hwnd", $hConsole, "STRUCT*", $lpConsoleCursorInfo) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func SetConsoleCtrlHandler($HandlerRoutine, $Add) Local $aRet = DllCall("kernel32.dll", "BOOL", "SetConsoleCtrlHandler", "ptr", $HandlerRoutine, "BOOL", $Add) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func GetConsoleScreenBufferInfo($hConsole, $tScreenBufferInfo) $aRet = DllCall("kernel32.dll", "bool", "GetConsoleScreenBufferInfo", "hwnd", $hConsole, "STRUCT*", $tScreenBufferInfo) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func GetConsoleCursorPosition($hConsoleOutput, $dwCursorPosition, $tScreenBufferInfo) GetConsoleScreenBufferInfo($hConsoleOutput, $tScreenBufferInfo) If @error <> 0 Then Return SetError(@error, @extended, False) $dwCursorPosition = DllStructCreate($tagCOORD, DllStructGetPtr($tScreenBufferInfo, 2)) $dwCursorPosition.X = $dwCursorPosition.X $dwCursorPosition.Y = $dwCursorPosition.Y Return True EndFunc Func SetConsoleCursorPosition($hConsoleOutput, $dwCursorPosition) Local $aRet = DllCall("kernel32.dll", "BOOL", "SetConsoleCursorPosition", "HANDLE", $hConsoleOutput, "STRUCT", $dwCursorPosition) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func ReadConsoleInput($hConsoleInput, $lpBuffer, $nLength) Local $aRet = DllCall("kernel32.dll", "BOOL", "ReadConsoleInput", "HANDLE", $hConsoleInput, "STRUCT*", $lpBuffer, "DWORD", $nLength, "DWORD*", 0) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func FillConsoleOutputCharacter($hConsoleInput, $cCharacter, $nLength, $dwWriteCoord) Local $aRet = DllCall("kernel32.dll", "BOOL", "FillConsoleOutputCharacterW", "HANDLE", $hConsoleInput, "BYTE", $cCharacter, "DWORD", $nLength, "STRUCT", $dwWriteCoord, "DWORD*", 0) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func SetConsoleScreenBufferSize($hConsoleOutput, $dwSize) Local $aRet = DllCall("kernel32.dll", "BOOL", "SetConsoleScreenBufferSize", "HANDLE", $hConsoleOutput, "STRUCT", $dwSize) If @error <> 0 Then Return SetError(@error, 0, False) Return $aRet[0] <> 0 EndFunc Func _ConsoleWriteCenter($columns, $rows, $hStdOut, $sText) Local $_tCOORD = DllStructCreate($tagCOORD) Local $tCOORD = DllStructCreate($tagCOORD) ;GetConsoleCursorPosition($hStdOut, $_tCOORD, $tScreenBufferInfo) Local $s = $sText Local $l = StringLen($s) $tCOORD.X = Round($columns / 2) - Round($l / 2) $tCOORD.Y = Round($rows / 2) SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, $s) SetConsoleCursorPosition($hStdOut, $_tCOORD) EndFunc Func _ConsoleHideCursor($hStdOut) Local $tConsoleCursorInfo = DllStructCreate($tagCONSOLE_CURSOR_INFO) GetConsoleCursorInfo($hStdOut, $tConsoleCursorInfo) $tConsoleCursorInfo.bVisible = 0 SetConsoleCursorInfo($hStdOut, $tConsoleCursorInfo) EndFunc #EndRegion Functions $a = AllocConsole() $aRet = DllCall("kernel32.dll", "ptr", "GetConsoleWindow") _WinAPI_ShowWindow($aRet[0], @SW_SHOWNORMAL) $hConOut = CreateFile("CONOUT$", BitOR($GENERIC_READ, $GENERIC_WRITE), BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), Null, $OPEN_EXISTING, $FILE_ATTRIBUTE_NORMAL) $hConIn = CreateFile("CONIN$", BitOR($GENERIC_READ, $GENERIC_WRITE), BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), Null, $OPEN_EXISTING, $FILE_ATTRIBUTE_NORMAL) Global Const $STD_INPUT_HANDLE = -10 Global Const $STD_OUTPUT_HANDLE = -11 Global Const $STD_ERROR_HANDLE = -12 SetStdHandle($STD_OUTPUT_HANDLE, $hConOut) SetStdHandle($STD_INPUT_HANDLE, $hConIn) $hStdIn = _WinAPI_GetStdHandle(0) $hStdOut = _WinAPI_GetStdHandle(1) _ConsoleHideCursor($hStdOut) Global Const $ENABLE_EXTENDED_FLAGS = 0x0080 ;FIXME: store the original mode and restore on exit, to avoid parent console being affected. SetConsoleMode($hStdIn, $ENABLE_EXTENDED_FLAGS) Global $iRun = 1 Global Const $CTRL_C_EVENT = 0 Global Const $CTRL_BREAK_EVENT = 1 Global Const $CTRL_CLOSE_EVENT = 2 Global Const $CTRL_LOGOFF_EVENT = 5 Global Const $CTRL_SHUTDOWN_EVENT = 6 Func HandlerRoutine($dwCtrlType) ;ConsoleWrite("HandlerRoutine"&@CRLF) $iRun = 0 ;https://stackoverflow.com/a/48190051 DllCall("kernel32.dll", "NONE", "ExitThread", "DWORD", 0) Return True EndFunc $hHandlerRoutine = DllCallbackRegister(HandlerRoutine, "BOOL", "DWORD") $pHandlerRoutine = DllCallbackGetPtr($hHandlerRoutine) SetConsoleCtrlHandler($pHandlerRoutine, 1) Global $tCOORD = DllStructCreate($tagCOORD) GLobal $oScreenBufferInfo = DllStructExCreate($tagCONSOLE_SCREEN_BUFFER_INFO) Global Const $tScreenBufferInfo = DllStructExGetStruct($oScreenBufferInfo) Global Const $tSrWindow = DllStructExGetStruct($oScreenBufferInfo.srWindow) GetConsoleScreenBufferInfo($hStdOut, $tScreenBufferInfo) Global $columns = $tSrWindow.Right - $tSrWindow.Left + 1 Global $rows = $tSrWindow.Bottom - $tSrWindow.Top + 1 ;ConsoleWrite(StringFormat("columns: %d\n", $columns)) ;ConsoleWrite(StringFormat("rows: %d\n", $rows)) ;ConsoleWrite(StringFormat("%s x %s\n", $oScreenBufferInfo.dwSize.X, $oScreenBufferInfo.dwSize.y)) Global $tScreenBufferSize = DllStructCreate($tagCOORD) $tScreenBufferSize.X = $columns $tScreenBufferSize.Y = $rows SetConsoleScreenBufferSize($hStdOut, $tScreenBufferSize) _ConsoleWriteCenter($columns, $rows, $hStdOut, StringFormat("%s x %s", $columns, $rows)) $tCOORD.X = 0 $tCOORD.Y = 0 Global Const $FOCUS_EVENT = 0x0010 Global Const $KEY_EVENT = 0x0001 Global Const $MENU_EVENT = 0x0008 Global Const $MOUSE_EVENT = 0x0002 Global Const $WINDOW_BUFFER_SIZE_EVENT = 0x0004 $oINPUT_RECORD = DllStructExCreate($tagINPUT_RECORD) $tINPUT_RECORD = DllStructExGetStruct($oINPUT_RECORD) $tEvent = DllStructExGetStruct($oINPUT_RECORD.Event) $tFocusEvent = DllStructExGetStruct($oINPUT_RECORD.Event.FocusEvent) $tKeyEvent = DllStructExGetStruct($oINPUT_RECORD.Event.KeyEvent) ConsoleWrite(StringFormat("$tFocusEvent: %s\n", DllStructGetPtr($tFocusEvent))) ConsoleWrite(StringFormat("$tKeyEvent: %s\n", DllStructGetPtr($tKeyEvent))) DllStructExDisplay($oINPUT_RECORD) While $iRun Sleep(10) If DllCall("kernel32.dll", "BOOL", "GetNumberOfConsoleInputEvents", "handle", $hStdIn, "DWORD*", 0)[2] > 0 Then SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, _StringRepeat(" ", $columns)) $tCOORD.Y = 1 SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, _StringRepeat(" ", $columns)) $tCOORD.Y = 0 SetConsoleCursorPosition($hStdOut, $tCOORD) ReadConsoleInput($hStdIn, $tINPUT_RECORD, 1) ;_WinAPI_WriteConsole($hStdOut, DllStructGetData($tINPUT_RECORD, 1)) Switch ($oINPUT_RECORD.EventType) Case $EventType_FOCUS_EVENT _WinAPI_WriteConsole($hStdOut, "FOCUS_EVENT") $tCOORD.Y = 1 SetConsoleCursorPosition($hStdOut, $tCOORD) ;_WinAPI_WriteConsole($hStdOut, StringFormat("bSetFocus: %s", $oINPUT_RECORD.Event.FocusEvent.bSetFocus)) _WinAPI_WriteConsole($hStdOut, StringFormat("bSetFocus: %s", $tFocusEvent.bSetFocus)) Case $EventType_KEY_EVENT _WinAPI_WriteConsole($hStdOut, "KEY_EVENT") $tCOORD.Y = 1 SetConsoleCursorPosition($hStdOut, $tCOORD) $oEvent = $oINPUT_RECORD.Event $oKeyEvent = $oEvent.KeyEvent $ouChar = $oKeyEvent.uChar _WinAPI_WriteConsole($hStdOut, StringFormat("uChar: %s", $oINPUT_RECORD.Event.KeyEvent.uChar.AsciiChar)) Case $EventType_MENU_EVENT _WinAPI_WriteConsole($hStdOut, "MENU_EVENT") $tCOORD.Y = 1 SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, StringFormat("dwCommandId: %s", $oINPUT_RECORD.Event.MenuEvent.dwCommandId)) Case $EventType_MOUSE_EVENT ;ConsoleWrite("MOUSE_EVENT"&@CRLF) _WinAPI_WriteConsole($hStdOut, "MOUSE_EVENT") Case $EventType_WINDOW_BUFFER_SIZE_EVENT _ConsoleHideCursor($hStdOut) $tCOORD.X = 0 $tCOORD.Y = 0 GetConsoleScreenBufferInfo($hStdOut, $tScreenBufferInfo) $columns = $tSrWindow.Right - $tSrWindow.Left + 1 $rows = $tSrWindow.Bottom - $tSrWindow.Top + 1 $tScreenBufferSize.X = $columns $tScreenBufferSize.Y = $rows SetConsoleScreenBufferSize($hStdOut, $tScreenBufferSize) FillConsoleOutputCharacter($hStdOut, " ", $columns * $rows, $tCOORD) SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, "WINDOW_BUFFER_SIZE_EVENT") $tCOORD.Y = 1 SetConsoleCursorPosition($hStdOut, $tCOORD) _WinAPI_WriteConsole($hStdOut, StringFormat("SIZE: %sx%s", $oINPUT_RECORD.Event.WindowBufferSizeEvent.dwSize.X, $oINPUT_RECORD.Event.WindowBufferSizeEvent.dwSize.Y)) _ConsoleWriteCenter($columns, $rows, $hStdOut, StringFormat("%s x %s", $columns, $rows)) Case Else _WinAPI_WriteConsole($hStdOut, "*UNKNOWN*") EndSwitch EndIf WEnd Exit For debugging, DllStructEx.debug.au3 can be used, and feedback for missing debug features is welcome
    1 point
  7. Done. Trac Ticket #3827 created
    1 point
  8. Aside : My opinion regarding the new feature of the 'Solved Counter' is somewhat ambivalent, frankly speaking. However, since this feature is now in place, and likely to remain, it should be used to make sense of it. @mike1950r : As @Nine 's contribution obviously solved your problem, you can mark it accordingly, if you like .
    1 point
  9. Thanks to @jpm it is fixed in recent beta. Take a look here for AutoIt v3.3.15.4 Beta: This version fixes: https://www.autoitscript.com/trac/autoit/ticket/3167
    1 point
  10. Hello, I fixed like this: #include <GuiListView.au3> #include <GuiConstantsEx.au3> $hGUI = GUICreate("Test", 500, 400) $idListView = GUICtrlCreateListView("Col0|Col1|Col2|Col3|Col4|Col5|Col6|Col7|Col8|Col9", 10, 10, 480, 300) For $i = 1 To 9 _GUICtrlListView_SetColumnWidth($idListView, $i, 200) Next $idItem1 = GUICtrlCreateListViewItem("0|1|2|3|4|5|6|7|8|9", $idListView) $idItem2 = GUICtrlCreateListViewItem("0|1|2|3|4|5|6|7|8|9", $idListView) $idButton = GUICtrlCreateButton("Click me", 200, 340, 85, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton ; click when scrollbar is on left, then with scrollbar on right _GUICtrlListView_ClickItemMod($idListView, 0) EndSwitch WEnd GUIDelete($hGUI) Func _GUICtrlListView_ClickItemMod($hWnd, $iIndex, $sButton = "left", $bMove = False, $iClicks = 1, $iSpeed = 1) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) _GUICtrlListView_EnsureVisible($hWnd, $iIndex, False) Local $tRECT = _GUICtrlListView_GetItemRectEx($hWnd, $iIndex, $LVIR_LABEL) Local $tPoint = _WinAPI_PointFromRect($tRECT, True) Local $iXPlus = DllStructGetData($tRECT, "Left") < 0 ? DllStructGetData($tRECT, "Left") * -1 : 0 $tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint) Local $iX, $iY _WinAPI_GetXYFromPoint($tPoint, $iX, $iY) Local $iMode = Opt("MouseCoordMode", 1) If Not $bMove Then Local $aPos = MouseGetPos() _WinAPI_ShowCursor(False) MouseClick($sButton, $iX + $iXPlus, $iY, $iClicks, $iSpeed) MouseMove($aPos[0], $aPos[1], 0) _WinAPI_ShowCursor(True) Else MouseClick($sButton, $iX + $iXPlus, $iY, $iClicks, $iSpeed) EndIf Opt("MouseCoordMode", $iMode) EndFunc ;==>_GUICtrlListView_ClickItemMod Saludos
    1 point
  11. You'd be better having a log file per user, it'll make it easier to read. I'd even go as far as filing them in Year and Month folders. #include <Date.au3> #include <File.au3> #include <FileConstants.au3> _AppendLog('Your User Name is: ' & @UserName) Func _AppendLog($sString) If FileExists(@ScriptDir & '\Logs\' & @UserName & '\' & @YEAR & '\' & _DateToMonth(@MON, $DMW_SHORTNAME)) = 0 Then DirCreate(@ScriptDir & '\Logs\' & @UserName & '\' & @YEAR & '\' & _DateToMonth(@MON, $DMW_SHORTNAME)) EndIf $hFile = FileOpen(@ScriptDir & '\Logs\' & @UserName & '\' & @YEAR & '\' & _DateToMonth(@MON, $DMW_SHORTNAME) & '\' & @MDAY & '.txt', $FO_APPEND) _FileWriteLog($hFile, $sString) FileClose($hFile) EndFunc If you're set on one log file however, like @Musashi said, definitely take a look at the LockFile UDF.
    1 point
  12. Gladly the code isn't responsible for that. As discussed today in this thread, spudw2k is encountering the same behavior in a very basic script I presented there. There's a problem with _GUICtrlListView_ClickItem() when an horizontal scrollbar is present. Now we have to find a solution for that. Edit: Trac Ticket #3827 created
    1 point
  13. Interesting behaviour. It appears the way the function works is by finding the rectangle area of the indexed item, then clicking in the center of it. You can see that when you drag the slider to the right as you described, the rectangle area is outside of the window area--if you change the mouse move parameter to true you can see exactly where it is clicking. Behind the scenes, the MouseMove parameter always moves the mouse there to click, then moves it back if the parameter is False. As a workaround, I would suggest using ControlFocus & _GUICtrlListView_SetItemSelected; you might also have to use EnsureVisible. If you absolutely have to click it then you might have to get a little creative and get the item rectangle coordinates, but instead of clicking the X position, just click the Y position and reference the control X position.
    1 point
  14. Assuming that everything else is correct, the most common reason for an immediate crash, when executing in 32bit mode, is that your APIs use the cdecl calling convention. By default, AutoIt uses stdcall. So you need to add ":cdecl" to all of your return data types. example: $aResult = DllCall($hEAPIdll, "DWORD:cdecl", "EApiUPSInitDev", _         "str", "COM1", _         "ptr", DllCallbackGetPtr($hAtCallback)) Read more about it in the DllCall help file topic. You can leave the :cdecl when running in 64bit mode, it'll be ignored.
    1 point
  15. Grasshopper, were were all naive once. Fresh eyed, seeing the world with awe and wonder. Life would have been a lot easier with a gentle hand holding, and a little less spoon feeding. Someone to light the way with a flickering candle. Stand on the shoulders of giants. Ask lots of pertinent questions with an open mind. Pay it forward. Be generous. Try and surprise a complete stranger with an unselfish act of kindness, at least once daily - it will be good for your soul.
    1 point
  16. Are you using SciTE as your code editor? Have you installed the help files? Read the examples and experiment, changing a little at a time to see what happens. Plan your project before you write any actual AutoIT code, writing down what you hope to achieve in higher level pseudo-code. Example: set up your environment define all your variables open file for input read file line by line process the information loop until finished close file cleanup is high level pseudo code that can be implemented in almost any computer language. Actually spell it out, not just have it in the back of your mind. The trap of learning to code in a particular language (such as scripting in AutoIT), before you understand the concepts needed to implement your goals is one we all fall into. Playing in a sandbox and trying things is a viable alternative when starting out, as often you learn the most when things break, not when they (unexpectedly and surprisingly) run well. Learn programming concepts first, variables, loops, branching, functions, error handling, files and data storage/access, etc, that are absolutely fundamental to being able to program in any language. Later you learn to break your code into manageable chunks, add debugging, document everything, test everything, and do things like add version control and staged releases into production. My secret: Code walkthough with a twist. Grab an innocent bystander - your grandmother, your next door neighbour teenager, somebody that doesn't know programming (important), and verbally explain to them what you are trying to achieve and the methods you are trying to get there. Use your computer terms, don't simplify. Ignore their reaction - you just need them to be attentive and listen. If you (not them) don't get confused and run off as you realise you have omitted something, there is a very good chance your program will be a success. Don't use a mirror - it doesn't work! For bigger projects, do this at the pseudo code level. Later go back and do it for actual language. You will be astonished how effective this is!
    1 point
  17. I wrote a book that covers some of the concepts at a high level (link below). In my opinion, the help file that is the best source for the most up to date changes to the language. This book follows along with the help file so if you unfamiliar with how to interpret the functions etc. it could be a good start if any of that is confusing. Would be good to know what types of things are challenging to you after you have read those other materials to point you in the right direction. Also, I would highly recommend thinking of a project, even a small one, and trying to code it - "on the job learning" so to speak. This forum is awesome for asking questions when you are stuck.
    1 point
  18. Holy crap, it works now. Thanks for the help, mate, you made my day
    1 point
  19. PsaltyDS

    Zoom IE

    There is no zoom in an IE ActiveX control (embedded) instance, even when done manually. So as far as I know you're out of luck. Exactly as with the full IE instance, XDPI and YDPI are there for read-only reference, though: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "http://www.autoitscript.com") $oScreen = $oIE.document.parentwindow.screen $iXDPI = $oScreen.deviceXDPI $iYDPI = $oScreen.deviceYDPI $iLogicalXDPI = $oScreen.logicalXDPI $iLogicalYDPI = $oScreen.logicalYDPI $iXZoom = $iXDPI / $iLogicalXDPI * 100 $iYZoom = $iYDPI / $iLogicalYDPI * 100 ConsoleWrite("$iXDPI = " & $iXDPI & "; $iYDPI = " & $iYDPI & @LF) ConsoleWrite("$iLogicalXDPI = " & $iLogicalXDPI & "; $iLogicalYDPI = " & $iLogicalYDPI & @LF) ConsoleWrite("Horizontal Zoom = %" & $iXZoom & "; Vertical Zoom = %" & $iYZoom & @LF) ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://www.autoitscript.com") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() Exit
    1 point
×
×
  • Create New...