Leaderboard
Popular Content
Showing content with the highest reputation on 02/25/2024 in all areas
-
IsAdmin not working on Windows 11
argumentum and one other reacted to dgood71 for a topic
With the EnableLUA set to 0 and a local administrator logged in, I don't know that it's even possible to run a program without elevated rights. At least, Windows 11 defaults to running with elevated rights, so I'm not sure how you would thwart that. I don't know that changing the way Control Viewer works would be worth the effort for any practical purpose, but perhaps so as a learning exercise to see if it's even possible. I only pointed out the Control Viewer behavior as a means to show that Windows can be made to run any program as elevated by default. Perhaps "by default" is the wrong way to state it, as there may not be any other option under those specific circumstances. So to sum up this thread, IsAdmin() is NOT broken in Windows 11. But Windows 11 can be made to act in a way that I hadn't known it could. So I learned something through all this. Thanks for your replies and for taking the time to test this behavior with me.2 points -
WebDriver - add function (wish)
Danp2 reacted to SOLVE-SMART for a topic
I checked wd_core.au3 (line 1122) => the function _WD_Option('version') already returns the version number of UDF library. So your request @Erik_NJ is already built in 😀 . Best regards Sven1 point -
Addition of two variables
LAteNightSpecial reacted to Melba23 for a topic
LAteNightSpecial, Er, no! If you read the OP, (s)he wants to concatenate the 2 variables - not perform arithmetic addition. The use of the "&" operator is entirely correct in this case. M231 point -
Addition of two variables
SOLVE-SMART reacted to Hicham_777 for a topic
the solution is var3 = var1 & var2 thanks for your suport.1 point -
Distributed Computing in AutoIt (Kind of...)
raphacp reacted to LAteNightSpecial for a topic
My apologies SmOke_N, I was a little confused as to where to post because the scripts were all incomplete and error prone. So, I was more looking for guidance and asking questions regarding what I was working on. Thank you for your understanding, and clarification.1 point -
SpellNumber function to convert numbers to words
ioa747 reacted to AspirinJunkie for a topic
To add a little more to the story - here is the German version: ConsoleWrite(_TextNumberGerman("-145323523001267.456") & @CRLF) Func _TextNumberGerman($nZahl, $iNachkommastellen = Default) Local $aSingular[8] = ["s", "tausend", "e Million", "e Milliarde", "e Billion", "e Billiarde", "e Trillion", "e Trilliarde"] Local $aPlural[8] = ["", "tausend", " Millionen", " Milliarden", " Billionen", " Billiarden", " Trillionen", " Trilliarden"] Local $aNullEins[8] = ["s", "stausend", "s Millionen", "s Milliarden", "s Billionen", "s Billiarden", "s Trillionen", "s Trilliarden"] Local $aKleiner20[19] = ["ein", "zwei", "drei", "vier", "fünf", "sechs", "sieben", "acht", "neun", "zehn", "elf", "zwölf", "dreizehn", "vierzehn", "fünfzehn", "sechzehn", "siebzehn", "achtzehn", "neunzehn"] Local $aZehner[8] = ["zwanzig", "dreißig", "vierzig", "fünzig", "sechzig", "siebzig", "achtzig", "neunzig"] Local $aDezimal[10] = ["null", "eins", "zwei", "drei", "vier", "fünf", "sechs", "sieben", "acht", "neun"] Local $sRet = "" ; konvertiere in string $nZahl = IsKeyword($iNachkommastellen) = 1 ? String($nZahl) : StringFormat("%." & $iNachkommastellen & "f", $nZahl) ; negative Zahlen If StringLeft($nZahl, 1) = "-" Then $nZahl = StringTrimLeft($nZahl, 1) $sRet = "Minus " EndIf Local $iGanz = StringInStr($nZahl, '.', 1) ? StringLeft($nZahl, StringInStr($nZahl, ".", 1)) : $nZahl Local $n = StringLen($iGanz), $h, $r, $z, $e Local $aGruppen[Ceiling($n / 3)] Local $sDezimal = StringInStr($nZahl, '.', 1) ? StringTrimLeft($nZahl, StringInStr($nZahl, ".", 1)) : "" Local $i = -1 While $iGanz > 0 ; iGanz in Dreiergruppen teilen: $i += 1 $aGruppen[$i] = Mod($iGanz, 1000) $iGanz = Int($iGanz / 1000) WEnd ; Ganzzahlanteil Local $h, $r, $z, $e While $i >= 0 If $aGruppen[$i] > 0 Then $h = Int($aGruppen[$i] / 100) $r = Mod($aGruppen[$i], 100) $z = Int($r / 10) $e = Mod($aGruppen[$i], 10) If $h > 0 Then $sRet &= $aKleiner20[$h - 1] & "hundert" If $r > 0 Then If $r < 20 Then $sRet &= $aKleiner20[$r - 1] Else If $e > 0 Then $sRet &= $aKleiner20[$e - 1] If $e > 0 And $z > 0 Then $sRet &= "und" If $z > 0 Then $sRet &= $aZehner[$z - 2] EndIf EndIf If $aGruppen[$i] = 1 Then $sRet &= $aSingular[$i] & " " ElseIf StringRight($aGruppen[$i], 2) = "01" Then $sRet &= $aNullEins[$i] & " " Else $sRet &= $aPlural[$i] & " " EndIf EndIf $i -= 1 WEnd $sRet = StringStripWS($sRet, 2) ; Dezimalteil If $sDezimal <> "" Then $sRet &= " Komma" For $sZiffer in StringSplit($sDezimal, "", 2) $sRet &= " " & $aDezimal[Int($sZiffer)] Next EndIf Return $sRet EndFunc ;==>_TextNumberGerman1 point -
IsAdmin not working on Windows 11
argumentum reacted to dgood71 for a topic
I actually have that UAC UDF as well and it shows the same results that the IsAdmin() function does. If EnableLUA=0 in the registry and the user has local admin rights the result always indicates that the process is running elevated. So I think this is just the way Windows works.1 point -
IsAdmin not working on Windows 11
argumentum reacted to dgood71 for a topic
Here's more information and I believe I've figured out the cause. Note I've seen this behavior on Windows 11 Enterprise 22H2 and 23H2. If UAC is set to off in the *registry* by setting the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA to 0 (which completely disables the UAC) then isadmin() always returns true IF the user has local administrator rights. This may be the way Windows 11 works, by running everything as an administrator if UAC is turned off in the registry. (I'm not sure if this is the way Windows 11 *actually* works but it appears to be) If the EnableLUA is set to 1, then IsAdmin() works as expected. (Note a reboot is required for any changes to this registry setting to take affect.) Changing the UAC slider in the control panel even to it's lowest setting still results in the EnableLUA registry setting remaining at 1. I believe Windows 10 works the same way, but I probably had a group policy active on my Windows 11 machines that changed the EnableLUA to 0 and that policy wasn't applied to my Windows 10 machines. So my perception that this is a difference between Windows 10 and 11 is probably incorrect. More info can be found here: https://superuser.com/questions/1013702/completely-disable-uac-in-windows-101 point -
Ring seems to miss the power of win32 so the whole windowsbase is missing like sendkeys, sendinput, com. It seems to be a nice language but misses a lot thats available in autoit for automating and controlling other applications. Maybe i am missing the documentation on how to do win32 stuff. I installed Ring and merging it with AutoIt would be similar to other attempts in other languages by making convenience functions that are equal in name to AutoIt but probably will behave a little different. Ring installs nice huge download huge pdf help file (2000+ pages), there is plenty of documentation but finding what you need can be harder. Nice compiling to standalone exe files It feels Very different but not hard to learn scite versus ringnotepad is similar in initial usage, just load and run an example from a folder Not a small executable, huge exe distribution 250+megabytes for below example helloworld Many examples Nicely just structured in plain folders It took me a while to find out how to deal with optional parameters (basically you need to pass a hash table) very flexible including renaming keywords so you could write ChangeRingKeyword see consolewrite Here a small function MsgBox and ConsoleWrite as a starter if someone starts making a compatibility library Load "guilib.ring" new qApp { $sString = "This is an example of writing to the console." ConsoleWrite($sString) // Running this in a text editor which can trap console output e.g. SciTE, will display value of $sString $myMessage="Hello Moon" MsgBox([:cTitle="Blank title", :cMessage=$myMessage]) exec() } //MsgBox([:flag=0, :cTitle="Blank title", :cMessage="Blank message", :timeout=0, :hwnd=0]) Func MsgBox pList new qMessagebox(null) { setwindowtitle(pList[:cTitle]) setText(pList[:cMessage]) setstandardbuttons(QMessageBox_Yes | QMessageBox_No | QMessageBox_Close) show() } func ConsoleWrite $someText { see $sometext } And here an example in purebasic1 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