Leaderboard
Popular Content
Showing content with the highest reputation on 08/18/2022 in all areas
-
https://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.3.16.1-rc1-setup.zip https://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.3.16.1-rc1.zip 3.3.16.1 (xxx, 2022) (Release) AutoIt: - Fixed #3866: REGEXPCLASS broken in 3.3.16.0. - Fixed #3875: GUICtrlSetResizing() performance. - Fixed #3865: Image Control resizing behave as forced $GUI_DOCKWIDTH and $GUI_DOCKHEIGHT. - Fixed #3764: StringRegExp() crash with patterns that cause infinite recursion. - Fixed #3876: Hex Number Arithmetic is incorrect. - Fixed #3879: Dim Map to Array. UDFs: - Fixed #3867: Changes in 'SecurityConstants.au3' to avoid name conflict. THIS IS A SCRIPT BREAKING CHANGE - Added: UBound[2] example. - Added: StringRegExp[5] example. - Added: _GUICtrlEdit_SetPadding() function and example. - Fixed: Regression in 3.3.15.1, _WinAPI_RegCreateKey() and _WinAPI_RegOpenkey(). - Added: _WinAPI_RegDeleteKey() can use $hKey as in RegRead(). - Fixed: Regression of #3835 on _GDIPlus_GraphicsGet*(). - Fixed #3871: _ArrayDisplay() Hang sorted array with Null element. - Fixed: _FTP_FileGetSize() very big size. - Fixed #3872: FTP-Server in AutoIt Help no longer accessible. - Fixed #3877: GUICtrlCreateLabel() overlapping controls doc precision ($WS_CLIPSIBLINGS). - Added #3863: _WinAPI_GetCapture(). - Added: Allows _DebugArrayDisplay() to be used in UserFunc. - Added: _ArrayDisplay() and _DebugArrayDisplay() support Min Column width. - Added: _Array2DCreate() support 1D and/or 2D arrays. - Added: _DebugReportVar() display DllStruct content. - Fixed #3883: _DebugArrayDisplay() produces uncalled console message. - Added: _ArrayDisplay() and _DebugArrayDisplay() display {Array[dims]}, {Map[nentry]} and {Object}.2 points
-
Hello again. Here is the correct example: ;~ #AutoIt3Wrapper_UseX64=y _CreateISO() Func _CreateISO() Local $sSourceDirectory = @ScriptDir & "\Test" Local $sOutFileIso = @ScriptDir & "\MyFile.iso" Local $oFS = ObjCreate("IMAPI2FS.MsftFileSystemImage") $oFS .FreeMediaBlocks = 0 $oFS.VolumeName = "MyISOName" $oFS.Root.AddTree($sSourceDirectory, False) Local $oRImage = $oFS.CreateResultImage() Local $oImgStream = ObjCreateInterface($oRImage.ImageStream(), '{0000000c-0000-0000-C000-000000000046}', _ "D1 hresult();D2 hresult();D3 hresult();D4 hresult();CopyTo hresult(ptr;UINT64;UINT64*;UINT64*);" & _ "D8 hresult();D9 hresult();D10 hresult();D11 hresult();Stat hresult(struct*;dword);") Local $tSTATSTG = DllStructCreate("byte[" & (@AutoItX64 ? 80 : 72) & "]") $oImgStream.Stat($tSTATSTG, 0x1) Local $icbSize = (DllStructCreate("UINT64 cbSize", DllStructGetPtr($tSTATSTG) + (@AutoItX64 ? 16 : 8))).cbSize Local $pFileStream = __MD_SHCreateStreamOnFile($sOutFileIso) Local $iRead, $iWritten $oImgStream.CopyTo($pFileStream, $icbSize, $iRead, $iWritten) EndFunc ;==>_CreateIso ;Create File Stream Func __MD_SHCreateStreamOnFile($sFilePath, $igrfMode = 0x00001001) Local $aCall = DllCall("shlwapi.dll", "long", "SHCreateStreamOnFileW", "wstr", $sFilePath, "dword", $igrfMode, "ptr*", 0) If $aCall[0] = 0 Then Return $aCall[3] EndIf Return 0 EndFunc ;==>__MD_SHCreateStreamOnFile I'm not so mad today. 🤠Saludos2 points
-
Looking for a .ISO UDF
Danyfirex reacted to argumentum for a topic
oh, no. I just tested what you posted and I'm like, hmm, makes a CD. Could it make a DVD, to put more than 600 megs. But that was the question. I thought maybe a "$oFS.MediaType = DVD_for_argumentum" and that was as simple as that. Edit: ...randomly clicking..., found me answer: Local $oFS = ObjCreate("IMAPI2FS.MsftFileSystemImage") $oFS.ChooseImageDefaultsForMediaType(0x12) ; 2=CDR, 6=DVDPLUSR, 0x12=BR ( https://www.autoitscript.com/forum/topic/73782-cddvd-burning-udf/ ) $oFS.FreeMediaBlocks = 0 Have not tested anything as far as burning the ISO or even creating an ISO to test sizes but, the definition it's there.1 point -
Looking for a .ISO UDF
mLipok reacted to argumentum for a topic
..any way to make a DVD instead of a CD ? ( if is just adding a declaration or something simple )1 point -
Finally I was able to attach to runing Chrome instances. Here is example script: #include "wd_helper.au3" #include "wd_capabilities.au3" # HOW TO TEST: ; At first run choose [Yes] to create new session Chrome running instance ; At second run choose [No] to attach to active Chrome running instance Global $_MY__WD_SESSION Global $__g_sDownloadDir = "" _Test() Exit Func _Test() Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Open new sesion ?" & @CRLF & "[ NO ] = Try attach to active Chrome instance") If $iAnswer = $IDYES Then _Testing_CreateSession() Return ; do not process next functions Else _Testing_AttachSession() _WD_Navigate($_MY__WD_SESSION, 'https://www.google.com/') EndIf $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Do you want to test ?" & @CRLF & "[ NO ] = Refresh - prevent expiration") If $iAnswer = $IDYES Then _Testing_WD_Navigate() Else _Testing_Refreshing() EndIf ; CleanUp _WD_DeleteSession($_MY__WD_SESSION) _WD_Shutdown() EndFunc ;==>_Test Func _Testing_CreateSession() $_MY__WD_SESSION = _MY__WD_SetupChrome(False, $__g_sDownloadDir, False) EndFunc ;==>_Testing_CreateSession Func _Testing_AttachSession() $_MY__WD_SESSION = _MY__WD_SetupChrome(False, $__g_sDownloadDir, True) EndFunc ;==>_Testing_AttachSession Func _Testing_Refreshing() While 1 ;~ _WD_Navigate($_MY__WD_SESSION, '') _WD_Action($_MY__WD_SESSION, 'REFRESH') Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", "Finish refreshing?" & @CRLF & "[No] = Refresh - prevent expiration", 60) If $iAnswer = $IDYES Then Return WEnd EndFunc ;==>_Testing_Refreshing Func _Testing_WD_Navigate() _WD_Navigate($_MY__WD_SESSION, 'https://www.autoitscript.com/forum') EndFunc ;==>_Testing_WD_Navigate Func _MY__WD_SetupChrome($b_Headless, $s_Download_dir = Default, $bTryAttach = False) If $s_Download_dir = Default Then $s_Download_dir = '' ElseIf $s_Download_dir Then If FileExists($s_Download_dir) = 0 Then $s_Download_dir = '' EndIf _WD_UpdateDriver('chrome') If @error Then Return SetError(@error, @extended, '') _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_CapabilitiesStartup() ;~ Local $s_AttachOption = (($bTryAttach) ? ("") : (" --remote-debugging-port=9222")) ;~ _WD_Option('DriverParams', '--log trace' & $s_AttachOption) _WD_CapabilitiesAdd('firstMatch', 'chrome') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('detach', False) _WD_CapabilitiesAdd('binary', "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") If $bTryAttach Then _WD_CapabilitiesAdd('debuggerAddress', '127.0.0.1:9222') Else _WD_CapabilitiesAdd('args', '--remote-debugging-port=9222') EndIf If $b_Headless Then _ _WD_CapabilitiesAdd('args', '--headless') If $s_Download_dir Then _ _WD_CapabilitiesAdd('prefs', 'download.default_directory', $s_Download_dir) _WD_CapabilitiesDump(@ScriptLineNumber & ' :WebDriver:Capabilities:') Local $iWebDriverPID = _WD_Startup() If @error Then Return SetError(@error, @extended, '') Local $s_Capabilities = _WD_CapabilitiesGet() Local $WD_SESSION = _WD_CreateSession($s_Capabilities) If @error Then Return SetError(@error, @extended, $WD_SESSION) Local $iBrowserPID = _WD_GetBrowserPID($iWebDriverPID, 'chrome') ConsoleWrite("! $iBrowserPID=" & $iBrowserPID & @CRLF) Return SetError(@error, @extended, $WD_SESSION) EndFunc ;==>_MY__WD_SetupChrome ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WD_GetBrowserPID ; Description ...: Get the PID of the browser that was launched by WebDriver ; Syntax ........: _WD_GetBrowserPID($iWebDriverPID, $sBrowserName) ; Parameters ....: $iWebDriverPID - WebDriver PID returned by _WD_Startup() ; $sBrowserName - [optional] Browser name from the list of supported browsers ($_WD_SupportedBrowsers) ; Return values .: Success - Browser PID ; Failure - 0 and sets @error to one of the following values: ; - $_WD_ERROR_GeneralError ; - $_WD_ERROR_NotSupported ; - $_WD_ERROR_NoMatch ; Author ........: mLipok ; Modified ......: Danp2 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WD_GetBrowserPID($iWebDriverPID, $sBrowserName = '') Local Const $sFuncName = "_WD_GetBrowserPID" Local $iErr = $_WD_ERROR_Success, $iExt = 0, $iIndex = 0, $sBrowserExe = '', $aProcessList, $iBrowserPID = 0, $sMessage = '' Local $sDriverProcessName = _WinAPI_GetProcessName($iWebDriverPID) If @error Or Not ProcessExists($iWebDriverPID) Then #REMARK ProcessExists($iWebDriverPID) is required because of ; https://www.autoitscript.com/trac/autoit/ticket/3894 $sDriverProcessName = '' $iErr = $_WD_ERROR_GeneralError $iExt = 1 $sMessage = 'Unable to retrieve WebDriver process name for given PID' ElseIf _ArraySearch($_WD_SupportedBrowsers, $sDriverProcessName, Default, Default, Default, Default, Default, $_WD_BROWSER_DriverName) = -1 Then $iErr = $_WD_ERROR_NotSupported $sMessage = 'WebDriverPID is related to not supported WebDriver exe name' Else If $sBrowserName Then $iIndex = _ArraySearch($_WD_SupportedBrowsers, $sBrowserName, Default, Default, Default, Default, Default, $_WD_BROWSER_Name) EndIf If @error Then $iErr = $_WD_ERROR_GeneralError $iExt = 2 $sMessage = 'BrowserName can not be found on supported browsers names list' Else $aProcessList = _WinAPI_EnumChildProcess($iWebDriverPID) If @error Then $iErr = $_WD_ERROR_GeneralError $iExt = 3 $sMessage = 'Session was not created properly' Else _ArrayDisplay($aProcessList, '$aProcessList') ; all not supported EXE file names should be removed from $aProcessList, for example "conhost.exe" can be used by WebDriver exe file For $iCheck = $aProcessList[0][0] To 1 Step -1 _ArraySearch($_WD_SupportedBrowsers, $aProcessList[$iCheck][1], Default, Default, Default, Default, Default, $_WD_BROWSER_ExeName) If @error Then _ArrayDelete($aProcessList, $iCheck) $aProcessList[0][0] -= 1 EndIf Next If $aProcessList[0][0] = 0 Then $iErr = $_WD_ERROR_GeneralError $iExt = 4 $sMessage = 'All child process (file names) are not listed on supported browsers exe' EndIf EndIf EndIf EndIf If $iErr = $_WD_ERROR_Success Then If $sBrowserName = '' Then $iBrowserPID = $aProcessList[1][0] Else $sBrowserExe = $_WD_SupportedBrowsers[$iIndex][$_WD_BROWSER_ExeName] For $i = 1 To $aProcessList[0][0] If $aProcessList[$i][1] = $sBrowserExe Then $iBrowserPID = $aProcessList[$i][0] $sMessage = "Browser - " & $aProcessList[$i][1] & " - PID = " & $iBrowserPID ExitLoop EndIf Next If Not $iBrowserPID Then $iErr = $_WD_ERROR_NoMatch $sMessage = 'BrowserExe related to requested BrowserName was not matched in the webdriver child process list' EndIf EndIf EndIf Return SetError(__WD_Error($sFuncName, $iErr, $sMessage, $iExt), $iExt, $iBrowserPID) EndFunc ;==>_WD_GetBrowserPID As so far the main issue was that we was trying to use: _WD_Option('DriverParams', '--log trace --remote-debugging-port=9222') but it should be : _WD_CapabilitiesAdd('args', '--remote-debugging-port=9222')1 point
-
I removed the code in my previous comment. It does not work. I tested a C++ code I don't know why I posted that sorry. I'm a little crazy 😨 these days. I'll try to convert the C++ code I tested. Saludos1 point
-
To use DllCall() correctly, be aware of the following: The AutoIt DllCall() function can only be used to execute functions in dll-files implemented in unmanaged languages such as C, C++ and Pascal. The DllCall() function cannot be used to execute functions in .NET assembly dll-files implemented in managed languages such as C#, F# or VB.NET. Note that this isn't an AutoIt limitation or a limitation in the DllCall() function. It's a very general limitation when trying to mix any unmanaged programming language with managed code. AutoIt is an unmanaged programming language. Fortunately, there are methods to integrate unmanaged and managed code. This also applies to AutoIt and C# code. With an AutoIt background, the DotNetAll.au3 UDF as implemented in Using C# and VB.NET Code is by far the easiest way to execute C# (or VB.NET) code directly within an AutoIt script. With this technique you have eg. no need for a C# (or VB.NET) IDE, but can handle all code in SciTE. See bottom of this post for a complete list of the benefits of the technique. But this method works best if the C# (or VB.NET) code only depends on internal .NET assembly dll-files or relatively simple external .NET assembly dll-files. In your case it seems to be a slightly more advanced external .NET assembly dll-file. To be sure to get the code working in AutoIt, use the technique briefly demonstrated in this post. This method requires an IDE to compile the C# code into a .NET assembly dll-file and it requires the dll-file to be registered with RegAsm.exe. Why is more C# code needed when a .NET assembly dll file already exists and contains the actual UploadZipFile() method? In your case with the UploadZipFile() method, it is necessary to add a bit more C# code to use the method in AutoIt. The problem is that UploadZipFile() is a static method, and a static method cannot be executed in AutoIt. In the C# code, you must include the .NET assembly dll file and you must write a small wrapper method that works in AutoIt. The wrapper method must be a simple public method as shown in the example in the link and the method must of course call the static UploadZipFile() method. Depending on your experience with AutoIt objects and C# code, getting the code to work isn't necessarily a completely trivial task.1 point
-
WebDriver UDF - Help & Support (III)
seadoggie01 reacted to Jos for a topic
*click* to avoid posts of people that don't read, which I know hardly happens, but still.......1 point