Jump to content

Danyfirex

MVPs
  • Posts

    2,651
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Danyfirex

  1. @ptrex here you have. OrdoWebView.7z Saludos
  2. Hello friends, I haven't used AutoIt for a long time, but I always like these challenges, and I never forget you. Apparently there is some bug in how GUICtrlCreateObj works and I don't have time to look internally at the bug. This way I was able to create the instance of the object. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $gATL = DllOpen("ATL.DLL") Global Const $gOleaut32 = DllOpen("oleaut32.dll") Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _TestOrdoWebView() Func _TestOrdoWebView() ConsoleWrite("AtlAxWinInit: " & AtlAxWinInit() & @CRLF) Local $pProgID = SysAllocString('OrdoWebView2.OrdoWebView') ConsoleWrite("SysAllocString('OrdoWebView2.OrdoWebView'): " & $pProgID & @CRLF) Local $hGUI = GUICreate("OrdoWebView2.OrdoWebView Test", (@DesktopWidth) / 1.2, (@DesktopHeight) / 1.2, Default, Default, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hResult = AtlAxCreateControl($pProgID, $hGUI) _SysFreeString($pProgID) Local $pIUnkown = AtlAxGetControl($hGUI) ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF) GUISetState() Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}") Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, "_OrdoWebView_", "__OrdoWebView") ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF) ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF) ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF) $oOrdoWebView2.Anchor = True $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1" $oOrdoWebView2.HomeURL = "http://www.google.com" $oOrdoWebView2.SearchEngine = 2 $oOrdoWebView2.SearchAuto = True $oOrdoWebView2.Init() While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail Sleep(100) WEnd $oOrdoWebView2.Navigate("https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542505") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>_TestOrdoWebView Func _OrdoWebView_InitComplete($oIEpDisp) ConsoleWrite("_OrdoWebView_InitComplete" & @CRLF) EndFunc ;==>_OrdoWebView_InitComplete Func AtlAxCreateControl($pProgID, $HWND) Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxCreateControl Func AtlAxGetControl($HWND) Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[2] EndFunc ;==>AtlAxGetControl Func AtlAxWinInit() Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit") If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxWinInit Func _SysFreeString($pBSTR) ; Author: Prog@ndy If Not $pBSTR Then Return SetError(2, 0, 0) DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_SysFreeString Func SysAllocString($str) ; Author: monoceres Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc ;==>SysAllocString ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos
  3. Hello, Another alternative. #include <WinAPIProc.au3> #include <WinAPI.au3> #include <GUIConstants.au3> Global $hGUI = GUICreate("GUI") Global $idbtnOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') _WinAPI_RegisterShellHookWindow($hGUI) Local $nMsg = 0 While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $idbtnOK _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at Default Position :-)") _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 10,10 Position :-)", 10, 10) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at " & @DesktopWidth - 300 & "," & @DesktopHeight - 300 & " Position :-)", @DesktopWidth - 300, @DesktopHeight - 300) _MsgBox(0, "", "Hello I'm an AutoIt Msgbox at 0,0 Position :-)", 0, 0) EndSelect WEnd _WinAPI_DeregisterShellHookWindow($hGUI) Exit Func _MsgBoxPostition($X = Default, $Y = Default) Local Static $aPos[] = [Default, Default] If $X = Default Or $Y = Default Then Return $aPos EndIf $aPos[0] = $X $aPos[1] = $Y EndFunc ;==>_MsgBoxPostition Func _MsgBox($iFlag, $Title, $Text, $X = Default, $Y = Default, $iTimeout = Default, $hWnd = Default) _MsgBoxPostition($X, $Y) MsgBox($iFlag, $Title, $Text, $iTimeout, $hWnd) EndFunc ;==>_MsgBox Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Switch $wParam Case $HSHELL_WINDOWCREATED If WinGetProcess($lParam) = @AutoItPID And _WinAPI_GetClassName($lParam) = "#32770" Then Local $aPos = _MsgBoxPostition() If $aPos[0] <> Default And $aPos[1] <> Default Then WinMove($lParam, "", $aPos[0], $aPos[1]) EndIf EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Saludos
  4. You would need to build some unique pattern. I've done things similar for for number before and worked perfectly. It is just a sample to handle it. but for sure it will work if you add a correct pattern for each number. Saludos
  5. Here my two cents. #include <GDIPlus.au3> Example() Func Example() _GDIPlus_Startup() ;initialize GDI+ Local Const $iWidth = 150, $iHeight = 150 Local $iColor = 0 Local $hBitmap = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\TestImage.png") Local $Y0 = 0 For $iY = 0 To $iHeight - 1 For $iX = 0 To $iWidth - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $Y0 = $iY ExitLoop 2 EndIf Next Next ;Find X Local $X0 = 0 For $iX = 0 To $iWidth - 1 For $iY = 0 To $iHeight - 1 $iColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) ;get current pixel color If $iColor = 4278255360 Then ;~ _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFFFF0000) ;~ ConsoleWrite($iX & "," & $iY & @CRLF) $X0 = $iX ExitLoop 2 EndIf Next Next ;~ _GDIPlus_BitmapSetPixel($hBitmap, $X0, $Y0, 0xFFFF0000) ConsoleWrite("TOP CORNER TEXT: " & $X0 & "," & $Y0 & @CRLF) Local $iFieldSizePixel14 = 16 Local $sNumber = "" For $iX = $X0 To $iWidth - 1 Step $iFieldSizePixel14 $sNumber &= _NumberFromPattern($hBitmap, $iX, $Y0) Next ConsoleWrite("Number: " & $sNumber & @CRLF) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==>Example Func _NumberFromPattern(ByRef $hBitmap, $X0, $Y0) Local $a3[] = ["0,4", "6,9"] Local $a7[] = ["0,0", "13,0"] Local $a4[] = ["9,0", "0,9"] Local $aSplit = 0 Local $iCount = 0 For $i = 0 To UBound($a3) - 1 $aSplit = StringSplit($a3[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 3 $iCount = 0 For $i = 0 To UBound($a7) - 1 $aSplit = StringSplit($a7[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 7 $iCount = 0 For $i = 0 To UBound($a4) - 1 $aSplit = StringSplit($a4[$i], ",", 2) If _GDIPlus_BitmapGetPixel($hBitmap, $X0 + ($aSplit[0]), $Y0 + ($aSplit[1])) = 4278255360 Then $iCount += 1 EndIf Next If $iCount = UBound($aSplit) Then Return 4 Return "" EndFunc ;==>_NumberFromPattern Using the image from here. You just need to build the pattern for the other numbers and try to make them unique. Saludos
  6. Remove the Sleep(1000) Saludos
  7. Hello. Here is a sample. #AutoIt3Wrapper_UseX64=n ;~ #RequireAdmin #include <WinAPISysWin.au3> #include ".\UIASpy\Includes\UIA_Constants.au3" HotKeySet("{ESC}", "Quit") ;Press ESC key to quit _Test() Func Quit() Exit EndFunc ;==>Quit Func _Test() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF) ConsoleWrite("$oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDesktop) Then Return ConsoleWrite("$oDesktop ERR" & @CRLF) ConsoleWrite("$oDesktop OK" & @CRLF) While Sleep(30) Local $hHandle = WinGetHandle("[ACTIVE]") If _WinAPI_GetClassName($hHandle) <> "Chrome_WidgetWin_1" Then ContinueLoop ConsoleWrite(WinGetTitle($hHandle) & @CRLF) Local $pCondition ; Note that $UIA_ClassNamePropertyId maybe ia a CASE SENSITIVE condition $oUIAutomation.CreatePropertyCondition($UIA_NativeWindowHandlePropertyId, Int($hHandle), $pCondition) ;hwnd need to be converted to int If Not $pCondition Then ContinueLoop ConsoleWrite("$pCondition OK") ;When searching for top-level windows on the desktop, be sure to specify TreeScope_Children in the scope parameter, not TreeScope_Descendants. ;A search through the entire subtree of the desktop could iterate through thousands of items and lead to a stack overflow. Local $pWindow $oDesktop.FindFirst($TreeScope_Children, $pCondition, $pWindow) Local $oWindow = ObjCreateInterface($pWindow, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow) Then ContinueLoop ConsoleWrite("$oWindow OK") Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0) If Not $pCondition0 Then ContinueLoop ConsoleWrite("$pCondition0 OK" & @CRLF) Local $pPaneChrome, $oPaneChrome $oWindow.FindFirst($TreeScope_Descendants, $pCondition0, $pPaneChrome) $oPaneChrome = ObjCreateInterface($pPaneChrome, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPaneChrome) Then ContinueLoop ConsoleWrite("$oPaneChrome OK" & @CRLF) Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition0) If Not $pCondition0 Then ContinueLoop ConsoleWrite("$pCondition0 OK" & @CRLF) Local $pPaneFirst, $oPaneFirst $oPaneChrome.FindFirst($TreeScope_Children, $pCondition0, $pPaneFirst) $oPaneFirst = ObjCreateInterface($pPaneFirst, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPaneFirst) Then ContinueLoop ConsoleWrite("$oPaneFirst OK" & @CRLF) Local $pCondition1 $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition1) If Not $pCondition1 Then ContinueLoop ConsoleWrite("$pCondition1 OK" & @CRLF) Local $pText1, $oText1 $oPaneFirst.FindFirst($TreeScope_Descendants, $pCondition1, $pText1) $oText1 = ObjCreateInterface($pText1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oText1) Then ContinueLoop ConsoleWrite("$oText1 OK" & @CRLF) Local $sValue = "" $oText1.GetCurrentPropertyValue($UIA_NamePropertyId, $sValue) ConsoleWrite($sValue & @CRLF) ToolTip($sValue,Default,Default,"Link") WEnd EndFunc ;==>_Test Saludos
  8. Maybe this; Local Const $tagIDispatch = _ "GetTypeInfoCount hresult(dword*);" & _ "GetTypeInfo hresult(dword;dword;ptr*);" & _ "GetIDsOfNames hresult(struct*;struct*;dword;dword;struct*);" & _ "Invoke hresult(uint;struct*;dword;word;struct*;struct*;ptr;uint*);" Local Const $sIID_INetworkConnection = "{DCB00005-570F-4A9B-8D69-199FDBA5723B}" Local Const $sTag_INetworkConnection = $tagIDispatch & _ "GetNetwork hresult()" & _ "IsConnectedToInternet hresult();" & _ "IsConnected hresult();" & _ "GetConnectivity hresult();" & _ "GetConnectionId hresult();" & _ "GetAdapterId hresult(clsid*);" & _ "GetDomainType hresult(int*);" Local $oObj = ObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}") ;NetworkListManager Local $oConnections = $oObj.GetNetworkConnections() For $oConnection In $oConnections Local $oConnectionCast = ObjCreateInterface($oConnection, $sIID_INetworkConnection, $sTag_INetworkConnection) Local $GUID = "" Local $iDomainType=0 $oConnectionCast.GetAdapterId($GUID) $oConnectionCast.GetDomainType($iDomainType) ConsoleWrite("GetAdapterId: " & $GUID & @CRLF) ConsoleWrite("GetDomainType: " & $iDomainType & @CRLF) ;~ ConsoleWrite($oConnection.GetAdapterId & @CRLF) ;this will not work ;~ ConsoleWrite($oConnection.GetDomainType & @CRLF) ;this will work Next Saludos
  9. Hello. Nice to find another Otaku here 🤣 I'm getting similar issue like Chimp (Sorry I meant @Gianni 🙊) look my screenshot Saludos
  10. I really don't know much about which one is better only that it gave me better results than tesseract in a project I was doing so that's why I made the wrapper. Saludos
  11. You're right inspect tool don't show the text but element is on top. weird. Saludos
  12. @jchd I meant make sure Your script and the Firefox instance are both same arch. (just to skip it could be the issue) also Can You try to find all edits with condition $UIA_ControlTypePropertyId, $UIA_EditControlTypeId? Saludos
  13. For sure it works with Group using the condition: $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_GroupControlTypeId, $pCondition) are you using correct Arch x64/x86 to be sure is not related to it. Edit: Can You try to find all edits with condition $UIA_ControlTypePropertyId, $UIA_EditControlTypeId? Saludos
  14. I was needing to copy some files something like a backup of a folder without overwrite file. I found in this thread a suggestion to use _WinAPI_ShellFileOperation but for my surprise it does overwrite files all the time 🤔. So I was checking MSDN and found out that IFileOperation implemented a nice operation flag to handle what I was needing(FOFX_KEEPNEWERFILE) so I just wrote this sample in case anyone was looking for it. #include <WinAPIShellEx.au3> ;~ Global Const $FOF_ALLOWUNDO = 0x40 ;~ Global Const $FOF_CONFIRMMOUSE = 0x2 ;~ Global Const $FOF_FILESONLY = 0x80 ;~ Global Const $FOF_MULTIDESTFILES = 0x1 ;~ Global Const $FOF_NO_CONNECTED_ELEMENTS = 0x2000 ;~ Global Const $FOF_NOCONFIRMATION = 0x10 ;~ Global Const $FOF_NOCONFIRMMKDIR = 0x200 ;~ Global Const $FOF_NOCOPYSECURITYATTRIBS = 0x800 ;~ Global Const $FOF_NOERRORUI = 0x400 ;~ Global Const $FOF_NORECURSION = 0x1000 ;~ Global Const $FOF_RENAMEONCOLLISION = 0x8 ;~ Global Const $FOF_SILENT = 0x4 ;~ Global Const $FOF_SIMPLEPROGRESS = 0x100 ;~ Global Const $FOF_WANTMAPPINGHANDLE = 0x20 ;~ Global Const $FOF_WANTNUKEWARNING = 0x4000 Global Const $FOFX_ADDUNDORECORD = 0x20000000 Global Const $FOFX_NOSKIPJUNCTIONS = 0x00010000 Global Const $FOFX_PREFERHARDLINK = 0x00020000 Global Const $FOFX_SHOWELEVATIONPROMPT = 0x00040000 Global Const $FOFX_EARLYFAILURE = 0x00100000 Global Const $FOFX_PRESERVEFILEEXTENSIONS = 0x00200000 Global Const $FOFX_KEEPNEWERFILE = 0x00400000 Global Const $FOFX_NOCOPYHOOKS = 0x00800000 Global Const $FOFX_NOMINIMIZEBOX = 0x01000000 Global Const $FOFX_MOVEACLSACROSSVOLUMES = 0x02000000 Global Const $FOFX_DONTDISPLAYSOURCEPATH = 0x04000000 Global Const $OFX_DONTDISPLAYDESTPATH = 0x08000000 Global Const $FOFX_RECYCLEONDELETE = 0x00080000 Global Const $FOFX_REQUIREELEVATION = 0x10000000 Global Const $FOFX_COPYASDOWNLOAD = 0x40000000 Global Const $FOFX_DONTDISPLAYLOCATIONS = 0x80000000 Global Const $IID_IShellItem = "{43826d1e-e718-42ee-bc55-a1e261c37bfe}" Global Const $dtag_IShellItem = _ "BindToHandler hresult(ptr;clsid;clsid;ptr*);" & _ "GetParent hresult(ptr*);" & _ "GetDisplayName hresult(int;ptr*);" & _ "GetAttributes hresult(int;int*);" & _ "Compare hresult(ptr;int;int*);" Global Const $IID_IShellItemArray = "{b63ea76d-1f85-456f-a19c-48159efa858b}" Global Const $dtagIShellItemArray = "BindToHandler hresult();GetPropertyStore hresult();" & _ "GetPropertyDescriptionList hresult();GetAttributes hresult();GetCount hresult(dword*);" & _ "GetItemAt hresult();EnumItems hresult();" Global Const $BHID_EnumItems = "{94F60519-2850-4924-AA5A-D15E84868039}" Global Const $IID_IEnumShellItems = "{70629033-e363-4a28-a567-0db78006e6d7}" Global Const $dtagIEnumShellItems = "Next hresult(ulong;ptr*;ulong*);Skip hresult();Reset hresult();Clone hresult();" Global Const $CLSID_IFileOperation = "{3AD05575-8857-4850-9277-11B85BDB8E09}" Global Const $IID_IFileOperation = "{947AAB5F-0A5C-4C13-B4D6-4BF7836FC9F8}" Global Const $dtagIFileOperation = "Advise hresult(ptr;dword*);" & _ "Unadvise hresult(dword);" & _ "SetOperationFlags hresult(dword);" & _ "SetProgressMessage hresult(wstr);" & _ "SetProgressDialog hresult(ptr);" & _ "SetProperties hresult(ptr);" & _ "SetOwnerWindow hresult(hwnd);" & _ "ApplyPropertiesToItem hresult(ptr);" & _ "ApplyPropertiesToItems hresult(ptr);" & _ "RenameItem hresult(ptr;wstr;ptr);" & _ "RenameItems hresult(ptr;wstr);" & _ "MoveItem hresult(ptr;ptr;wstr;ptr);" & _ "MoveItems hresult(ptr;ptr);" & _ "CopyItem hresult(ptr;ptr;wstr;ptr);" & _ "CopyItems hresult(ptr;ptr);" & _ "DeleteItem hresult(ptr;ptr);" & _ "DeleteItems hresult(ptr);" & _ "NewItem hresult(ptr;dword;wstr;wstr;ptr);" & _ "PerformOperations hresult();" & _ "GetAnyOperationsAborted hresult(ptr*);" _Test() Func _Test() Local $sPathFrom = @ScriptDir & "\PathFrom\" Local $sPathTo = @ScriptDir & "\PathTo\" DirRemove($sPathFrom, 1) DirRemove($sPathTo, 1) DirCreate($sPathFrom) For $i = 1 To 5000 FileWrite($sPathFrom & $i & ".txt", "Hello World - " & $i) Next _WinAPI_ShellFileOperation($sPathFrom & "*.*", $sPathTo, $FO_COPY, BitOR($FOF_NOERRORUI, $FOF_NOCONFIRMATION)) ;update file From and To FileWrite($sPathFrom & 1 & ".txt", " Only this should be update in 'To' Folder") FileWrite($sPathTo & 2 & ".txt", " This should not be overwritten but it does :(") MsgBox(0, "ShellFileOperation", "Check these files: " & @CRLF & $sPathFrom & 1 & ".txt" & @CRLF & @CRLF & $sPathTo & 2 & ".txt") _WinAPI_ShellFileOperation($sPathFrom & "*.*", $sPathTo, $FO_COPY, BitOR($FOF_NOERRORUI, $FOF_NOCONFIRMATION)) MsgBox(0, "ShellFileOperation", "Check these files: " & @CRLF & $sPathFrom & 1 & ".txt" & @CRLF & @CRLF & $sPathTo & 2 & ".txt") ;update file From and To FileWrite($sPathFrom & 1 & ".txt", " - I was updated again :-S") FileWrite($sPathTo & 2 & ".txt", " This will not be overwritten :)") MsgBox(0, "IFileOperation", "Check these files: " & @CRLF & $sPathFrom & 1 & ".txt" & @CRLF & @CRLF & $sPathTo & 2 & ".txt") _IFileOperationCopyFiles($sPathFrom, $sPathTo) MsgBox(0, "IFileOperation", "Check these files: " & @CRLF & $sPathFrom & 1 & ".txt" & @CRLF & @CRLF & $sPathTo & 2 & ".txt") DirRemove($sPathFrom, 1) DirRemove($sPathTo, 1) EndFunc ;==>_Test Func _IFileOperationCopyFiles($sPathFrom, $sPathTo, $iFlags = BitOR($FOF_NOERRORUI, $FOFX_KEEPNEWERFILE, $FOFX_NOCOPYHOOKS, $FOF_NOCONFIRMATION)) If Not FileExists($sPathFrom) Then Return SetError(1, 0, False) EndIf If Not FileExists($sPathTo) Then DirCreate($sPathTo) EndIf Local $tIIDIShellItem = CLSIDFromString($IID_IShellItem) Local $tIIDIShellItemArray = CLSIDFromString($IID_IShellItemArray) Local $oIFileOperation = ObjCreateInterface($CLSID_IFileOperation, $IID_IFileOperation, $dtagIFileOperation) If Not IsObj($oIFileOperation) Then Return SetError(2, 0, False) Local $pIShellItemFrom = 0 Local $pIShellItemTo = 0 _SHCreateItemFromParsingName($sPathFrom, 0, DllStructGetPtr($tIIDIShellItem), $pIShellItemFrom) _SHCreateItemFromParsingName($sPathTo, 0, DllStructGetPtr($tIIDIShellItem), $pIShellItemTo) If Not $pIShellItemFrom Or Not $pIShellItemTo Then Return SetError(3, 0, False) Local $oIShellItem = ObjCreateInterface($pIShellItemFrom, $IID_IShellItem, $dtag_IShellItem) Local $pEnum = 0 $oIShellItem.BindToHandler(0, $BHID_EnumItems, $IID_IEnumShellItems, $pEnum) Local $oIEnumShellItems = ObjCreateInterface($pEnum, $IID_IEnumShellItems, $dtagIEnumShellItems) If Not $pEnum Then Return SetError(4, 0, False) $oIFileOperation.SetOperationFlags($iFlags) Local $pItem = 0 Local $iFeched = 0 While $oIEnumShellItems.Next(1, $pItem, $iFeched) = 0 $oIFileOperation.CopyItems($pItem, $pIShellItemTo) WEnd Return $oIFileOperation.PerformOperations() = 0 EndFunc ;==>_IFileOperationCopyFiles Func _SHCreateItemFromParsingName($szPath, $pbc, $riid, ByRef $pv) Local $aRes = DllCall("shell32.dll", "long", "SHCreateItemFromParsingName", "wstr", $szPath, "ptr", $pbc, "ptr", $riid, "ptr*", 0) If @error Then Return SetError(1, 0, @error) $pv = $aRes[4] Return $aRes[0] EndFunc ;==>_SHCreateItemFromParsingName Func CLSIDFromString($sString) Local $tCLSID = DllStructCreate("dword;word;word;byte[8]") Local $aRet = DllCall("Ole32.dll", "long", "CLSIDFromString", "wstr", $sString, "ptr", DllStructGetPtr($tCLSID)) If @error Then Return SetError(1, 0, @error) If $aRet[0] <> 0 Then Return SetError(2, $aRet[0], 0) Return $tCLSID EndFunc ;==>CLSIDFromString Saludos
  15. Creo que si le das permitir la primera vez manualmente ya no te saldría esa ventana de permitir. I think once you click allow You will not get that request window again. PM I could probably help you. Escríbeme quizás podría ayudarte por privado. Saludos
  16. Hello just converted it for fun. Local $sTag_NDIS_MEDIUM = "uint64 InterfaceLuid;int InterfaceIndex;dword Data1InterfaceGuid; word Data2InterfaceGuid; word Data3InterfaceGuid; byte Data4InterfaceGuid[8];wchar Alias[257];wchar Description[257];ulong PhysicalAddressLength;" & _ "byte PhysicalAddress[32];byte PermanentPhysicalAddress[32];ulong Mtu;ulong Type;int TunnelType;int MediaType;int PhysicalMediumType;int AccessType;int DirectionType;" & _ "boolean HardwareInterface;boolean FilterInterface;boolean ConnectorPresent;boolean NotAuthenticated;boolean NotMediaConnected;boolean Paused;boolean LowPower;boolean EndPointInterface;" & _ "int OperStatus;int AdminStatus;int MediaConnectState;dword Data1NetworkGuid; word Data2NetworkGuid; word Data3NetworkGuid; byte Data4NetworkGuid[8];int ConnectionType;" & _ "uint64 TransmitLinkSpeed;uint64 ReceiveLinkSpeed;uint64 InOctets;uint64 InUcastPkts;uint64 InNUcastPkts;uint64 InDiscards;uint64 InErrors;uint64 InUnknownProtos;" & _ "uint64 InUcastOctets;uint64 nMulticastOctets;uint64 InBroadcastOctets;uint64 OutOctets;uint64 OutUcastPkts;uint64 OutNUcastPkts;uint64 OutDiscards;uint64 OutErrors;" & _ "uint64 OutUcastOctets;uint64 OutMulticastOctets;uint64 OutBroadcastOctets;uint64 OutQLen;" Local $tNDIS_MEDIUM = DllStructCreate($sTag_NDIS_MEDIUM) ConsoleWrite(DllStructGetSize($tNDIS_MEDIUM) & @CRLF) Saludos
  17. You can do it like this: #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) HotKeySet("{ESC}", "_Exit") TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "_TrayEventClick") While Sleep(30) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _TrayEventClick() MsgBox(0,"","Tray Icon Clicked :-)") EndFunc ;==>_TrayEventClicked Saludos
  18. File is missing? 🤔 Edit: Working Already. Saludos
  19. Hello again. I did this for uploading files to my own chat in Telegram (Portable Version and Installed Version) #include <WinAPIProc.au3> #include <File.au3> #include <WinAPIShellEx.au3> _Test_TelegramPortable() _Test_TelegramInstalled() Func _Test_TelegramPortable() Local $sFolderWithMyFilesToUpload = @DesktopDir & "\FilesToUpload" Local $sChatNameToSearch = "Saved Messages" ;get telegam portable window handle Local $aWindows = WinList("[CLASS:Qt51513QWindowIcon]") Local $hWinTelegram = 0 For $i = 1 To $aWindows[0][0] If (Not StringRegExp($aWindows[$i][0], "Media viewer|TelegamDesktop")) And _WinAPI_GetProcessName(WinGetProcess($aWindows[1][1])) = "Telegram.exe" Then $hWinTelegram = $aWindows[$i][1] ExitLoop EndIf Next WinActivate($hWinTelegram) Send("{ESC}") Sleep(200) Send("{ESC}") Sleep(200) Send("{ESC}") Send("{ESC 5}") ;this will let me go back from any chat and get Search chat selected Send("{BS 15}") Send($sChatNameToSearch) Send("{ENTER}") Local $aList = _FileListToArray($sFolderWithMyFilesToUpload, '*.*', 1) If IsArray($aList) Then _WinAPI_ShellOpenFolderAndSelectItems($sFolderWithMyFilesToUpload, $aList, 1) Sleep(100) Send("^c") Sleep(100) WinActivate($hWinTelegram) Sleep(100) Send("^v") Sleep(1000) Send("This are my file from the folder " & BinaryToString("0xF09F93A2",4)) Sleep(100) Send("{ENTER}") EndIf EndFunc ;==>_Test_TelegramPortable Func _Test_TelegramInstalled() Local $sFolderWithMyFilesToUpload = @DesktopDir & "\FilesToUpload" ShellExecute(@UserProfileDir & "\AppData\Local\Programs\Telegram A\Telegram A.exe", "tg://resolve?domain=Danyfirex") ;Saved Messages use own username Local $hWinTelegram=WinWaitActive("Saved Messages · Telegram A") ;when open my own chat Its Saved Messages Local $aList = _FileListToArray($sFolderWithMyFilesToUpload, '*.*', 1) If IsArray($aList) Then _WinAPI_ShellOpenFolderAndSelectItems($sFolderWithMyFilesToUpload, $aList, 1) Sleep(100) Send("^c") Sleep(100) WinActivate($hWinTelegram) Sleep(100) Send("^v") Sleep(1000) Send("This are my file from the folder " & BinaryToString("0xF09F93A2",4)) Sleep(100) Send("{ENTER}") EndIf EndFunc ;==>_Test_TelegramInstalled Saludos
  20. I think you can handle easily with this. Its a python library. if you need to mix with AutoIt probably compile it and pass parameters with command line will work. Saludos
  21. Look for UIAutomation in the forum. Saludos
  22. that's the first step just add the email you need to do/add some code to full log in. I only teach you how to catch the fish, but if you only want the fish you have to pay for it. 😅 Saludos
  23. @demon964 You can do it like this: #include "UIA_Constants.au3" _Test() Func _Test() ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF) ConsoleWrite("$oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDesktop) Then Return ConsoleWrite("$oDesktop ERR" & @CRLF) ConsoleWrite("$oDesktop OK" & @CRLF) Local $pCondition1 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "ApplicationFrameWindow", $pCondition1) If Not $pCondition1 Then Return ConsoleWrite("$pCondition1 ERR" & @CRLF) ConsoleWrite("$pCondition1 OK" & @CRLF) Local $pWindow1, $oWindow1 $oDesktop.FindFirst($TreeScope_Children, $pCondition1, $pWindow1) $oWindow1 = ObjCreateInterface($pWindow1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow1) Then Return ConsoleWrite("$oWindow1 ERR" & @CRLF) ConsoleWrite("$oWindow1 OK" & @CRLF) Local $pCondition0 $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Enter your email, phone, or Skype.", $pCondition0) ;change this for your Russian Edit Text If Not $pCondition0 Then Return ConsoleWrite("$pCondition0 ERR" & @CRLF) ConsoleWrite("$pCondition0 OK" & @CRLF) Local $pEdit1, $oEdit1 $oWindow1.FindFirst($TreeScope_Descendants, $pCondition0, $pEdit1) $oEdit1 = ObjCreateInterface($pEdit1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oEdit1) Then Return ConsoleWrite("$oEdit1 ERR" & @CRLF) ConsoleWrite("$oEdit1 OK" & @CRLF) Local $pLegacyIAccessiblePattern1, $oLegacyIAccessiblePattern1 $oEdit1 .GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pLegacyIAccessiblePattern1) $oLegacyIAccessiblePattern1 = ObjCreateInterface($pLegacyIAccessiblePattern1, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern) If Not IsObj($oLegacyIAccessiblePattern1) Then Return ConsoleWrite("$oLegacyIAccessiblePattern1 ERR" & @CRLF) ConsoleWrite("$oLegacyIAccessiblePattern1 OK" & @CRLF) Local $iStr = "Danyfirex@autoit.com" $oLegacyIAccessiblePattern1.SetValue($iStr) EndFunc ;==>_Test Saludos
  24. No issue in my side. working correclty using Latest version of the UDF , WebDriverVersion: 123.0.6312.86 and getting console Hidden fine. _Test() Func _Test() MsgBox(0, @AutoItVersion, _WD_GetBrowserVersion("Chrome") & @CRLF & _WD_GetWebDriverVersion(@ScriptDir, "chromedriver.exe") & @CRLF & _WD_IsLatestRelease()) Local $sCapabilities = SetupChrome(False) Local $iWebDriver_PID = _WD_Startup() _WD_ConsoleVisible(False) Local $sSession = _WD_CreateSession($sCapabilities) _WD_Navigate($sSession, 'https://www.google.com') _WD_LoadWait($sSession) MsgBox(0, "", "Show console after me") _WD_ConsoleVisible(True) MsgBox(0, "", "Exit After me") If $sSession Then _WD_DeleteSession($sSession) If $iWebDriver_PID Then _WD_Shutdown() EndFunc ;==>_Test Saludos
×
×
  • Create New...