Leaderboard
Popular Content
Showing content with the highest reputation on 05/28/2021 in all areas
-
Utorrent AutoLoad Torrent Files With SkipHash check option.
JockoDundee and 2 others reacted to RTFC for a topic
Absolutely, we'll get right on it! Would you like a foot massage while you wait?3 points -
Using the AutoIt PowerShell Cmdlets
NoNameCode reacted to Jon for a topic
This is a quick start guide to using the AutoIt PowerShell Cmdlets. The best bits of AutoIt directly from PowerShell The files you need are as follows (get them from the zip file or the Program Files folder after installation): AutoItX.psd1AutoItX3.PowerShell.dllAutoItX3.Assembly.dllAutoItX3.dllAutoItX3_x64.dllTo use the Cmdlets open a PowerShell cmd prompt and enter: Import-Module .\AutoItX.psd1 Now you can get a list of available AutoIt Cmdlets by doing Get-Command *AU3*: PS> Get-Command *AU3* Name Category Module ---- -------- ------ Invoke-AU3MouseWheel Cmdlet AutoItX Move-AU3Mouse Cmdlet AutoItX Invoke-AU3MouseClickDrag Cmdlet AutoItX Get-AU3MouseCursor Cmdlet AutoItX Invoke-AU3MouseUp Cmdlet AutoItX Assert-AU3WinActive Cmdlet AutoItX Assert-AU3WinExists Cmdlet AutoItX Assert-AU3IsAdmin Cmdlet AutoItX Invoke-AU3Shutdown Cmdlet AutoItX Send-AU3ControlKey Cmdlet AutoItX Invoke-AU3MouseDown Cmdlet AutoItX Invoke-AU3MouseClick Cmdlet AutoItX Invoke-AU3ControlTreeView Cmdlet AutoItX Invoke-AU3ControlListView Cmdlet AutoItX Invoke-AU3ControlCommand Cmdlet AutoItX Invoke-AU3ControlClick Cmdlet AutoItX Move-AU3Control Cmdlet AutoItX Set-AU3ControlText Cmdlet AutoItX Show-AU3Control Cmdlet AutoItX Hide-AU3Control Cmdlet AutoItX Get-AU3ControlText Cmdlet AutoItX Get-AU3ControlFocus Cmdlet AutoItX Set-AU3ControlFocus Cmdlet AutoItX Disable-AU3Control Cmdlet AutoItX Enable-AU3Control Cmdlet AutoItX Get-AU3StatusbarText Cmdlet AutoItX Invoke-AU3RunAsWait Cmdlet AutoItX Invoke-AU3RunAs Cmdlet AutoItX Invoke-AU3RunWait Cmdlet AutoItX Invoke-AU3Run Cmdlet AutoItX Set-AU3Clip Cmdlet AutoItX Get-AU3Clip Cmdlet AutoItX Set-AU3WinTrans Cmdlet AutoItX Set-AU3WinTitle Cmdlet AutoItX Set-AU3WinState Cmdlet AutoItX Set-AU3WinOnTop Cmdlet AutoItX Move-AU3Win Cmdlet AutoItX Show-AU3WinMinimizeAllUndo Cmdlet AutoItX Show-AU3WinMinimizeAll Cmdlet AutoItX Get-AU3WinState Cmdlet AutoItX Get-AU3WinProcess Cmdlet AutoItX Get-AU3WinClassList Cmdlet AutoItX Get-AU3WinCaretPos Cmdlet AutoItX Get-AU3WinClientSize Cmdlet AutoItX Get-AU3ControlPos Cmdlet AutoItX Get-AU3ControlHandle Cmdlet AutoItX Get-AU3MousePos Cmdlet AutoItX Get-AU3WinPos Cmdlet AutoItX Get-AU3WinHandle Cmdlet AutoItX Get-AU3ErrorCode Cmdlet AutoItX Initialize-AU3 Cmdlet AutoItX Show-AU3WinActivate Cmdlet AutoItX Close-AU3Win Cmdlet AutoItX Wait-AU3WinClose Cmdlet AutoItX Wait-AU3WinNotActive Cmdlet AutoItX Set-AU3Option Cmdlet AutoItX Send-AU3Key Cmdlet AutoItX Wait-AU3Win Cmdlet AutoItX Wait-AU3WinActive Cmdlet AutoItX Get-AU3WinTitle Cmdlet AutoItX Get-AU3WinText Cmdlet AutoItX I’ll show how to use the Cmdlets using a simple example that will open notepad.exe and modify the edit window by setting the text and simulating some keystrokes. First create a blank PowerShell script called notepad_example.ps1 in the same folder as the AutoItX components above and open it for editing. Now we want to import the PowerShell module which is AutoItX.psd1. Enter the following in the script: Import-Module .\AutoItX.psd1 We want to run notepad.exe: Invoke-AU3Run -Program notepad.exe After notepad opens we want to wait for the notepad “Untitled -Notepad” window to appear. You might need to change the title for non-English versions of Windows: $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle Get-AU3WinHandle returns a native Win32 handle to the notepad window. We can use this handle in many other AutoIt functions and it uniquely identifies the window which is much more reliable than constantly using a windows title. If you have obtained a window handle using any other Win32 function you can use it with AutoIt. After obtaining the handle to the notepad window we want to ensure that the window is active and then get a handle to the Edit Control. Using the AU3Info.exe tool that comes with AutoIt we can find that the name of the edit control in notepad is Edit1. Show-AU3WinActivate -WinHandle $winHandle $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" Now that we have a handle to the edit control we can set text in two ways: Directly (Set-AU3Controltext) or with simulated keystrokes (Send-AU3ControlKey): Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandleNow let’s see what the entire script looks like: # Import the AutoIt PowerShell module Import-Module .\AutoItX.psd1 # Run notepad.exe Invoke-AU3Run -Program notepad.exe # Wait for an untitled notepad window and get the handle $notepadTitle = "Untitled - Notepad" Wait-AU3Win -Title $notepadTitle $winHandle = Get-AU3WinHandle -Title $notepadTitle # Activate the window Show-AU3WinActivate -WinHandle $winHandle # Get the handle of the notepad text control for reliable operations $controlHandle = Get-AU3ControlHandle -WinHandle $winhandle -Control "Edit1" # Change the edit control Set-AU3ControlText -ControlHandle $controlHandle -NewText "Hello! This is being controlled by AutoIt and PowerShell!" -WinHandle $winHandle # Send some keystrokes to the edit control Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 1" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}simulate key strokes - line 2" -WinHandle $winHandle Send-AU3ControlKey -ControlHandle $controlHandle -Key "{ENTER}{ENTER}" -WinHandle $winHandle This is how the notepad window should look if everything is working correctly:1 point -
Check if included file is called
JockoDundee reacted to argumentum for a topic
hmm, good comment. Is this troll food ?1 point -
Based on the C# snippet that you supplied, your translation of that snippet, and the actual declaration of the function that I looked up, I see several issues and things that look odd. This is the declaration of the function: LZO_EXTERN(int) lzo1x_1_compress (const lzo_bytep src, lzo_uint src_len, lzo_bytep dst, lzo_uintp dst_len, lzo_voidp wrkmem); Your AutoIt function calls lzo1c_1_compress() but the C# snippet calls lzo1x_1_compress(). Both functions exist so that leads me to wonder why you used a different function than the C# snippet? The C# snippet returns the compressed buffer. Your AutoIt function does not. Is $compressedBuffer a global variable that is used by the caller? Also, you are aware that if the AutoIt DllCall is successful, $compressedBuffer is an array that contains the return code and all of the parameters, correct?. It is not just the compressed data buffer. The function uses the cdecl calling convention. Your DllCall is using the stdcall calling convention. In your DllCall, you are missing the 5th parameter, wrkmem, which is a pointer to a 64k byte buffer. The 4th parameter is a uint*. In your function, you pass it a value of zero. You need to pass it a pointer to an integer, not the value of an integer. This alone could've caused the memory access violation error that you encountered. (rc = -1073741819 / 0xC0000005). In general, it would also help if you checked @error AND the function's return code after all DllCalls to make sure that they are successful. Those are observations based purely at looking at what you provided. If you had supplied an executable example that included the DLL, that reproduced the error, one wouldn't need to make observations. They could tell you definitively what the problems are because they would've been able to test their conclusions. By supplying just a function, without the context of how it is being called and used by the caller, means that there could be other issues.1 point
-
I meant this: I see three ptrs in the c# func def: and ditto in the actual call: which references this preallocated buffer: AFAICT, you neither allocate nor parse a reference to this buffer in your AutoIt version of the call.1 point
-
Check if included file is called
argumentum reacted to Jos for a topic
Sure, just add this at the top of the Include file and adapt the "includename.au3" the real name of the include file. if @ScriptName = "includename.au3" then msgbox(0, "NO you ....", " ..... dumbass ... you are doing it again!!!!! ;)") EndIf Jos1 point -
Okay, last try: I don't see a work memory ptr being parsed in your AutoIt call.1 point
-
If the dll's calling convention is cdecl, you need to specify that in each call (append ":cdecl" to the return type).1 point
-
If running from Scite, ensure you are running in x64 mode if calling a 64-bit dll. By default, it could be running in 32 bit mode.1 point
-
Hello, Me and @mLipok we have problem with creating a sessions. There is no problem on our local computers. We only have a problem on some computers at customer's premises but not at all. Below is the function: Func _MY__WD_SetupChrome($b_Headless) $_WD_DEBUG = $_WD_DEBUG_Error _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) Local $s_Desired_Capabilities If $b_Headless Then $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default"]}}}}' ;~ $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default", "--no-sandbox"]}}}}' ;~ $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars"]}}}}' Else $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default"]}}}}' ;~ $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default", "--no-sandbox"]}}}}' ;~ $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"]}}}}' EndIf _WD_Startup() Local $WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) Return SetError(@error, @extended, $WD_SESSION) EndFunc ;==>_MY__WD_SetupChrome We tried with diffrent Capabilities : 1. With this Capabilites $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default"]}}}}' we have such an error: ! @error=10 @extended=500 2. With this Capabilites: $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars"]}}}}' ;~ $s_Desired_Capabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--headless", "start-maximized", "disable-infobars","user-data-dir=C:\\Users\\' & @UserName & '\\AppData\\Local\\Google\\Chrome\\User Data\\Default", "--no-sandbox"]}}}}' we have such an error: ! @error=10 @extended=0 Maybe someone has encountered the above errors and knows how to solve the problem??1 point
-
#Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> $Restored = True $hGUI = GUICreate("Test", 640, 480, -1, -1, $WS_OVERLAPPEDWINDOW) $Button1 = GUICtrlCreateButton("Maximize", 80, 56, 113, 33) GUISetState() GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 WinSetState($hGUI, "", @SW_MAXIMIZE) Sleep(1000) WinSetState($hGUI, "", @SW_RESTORE) EndSwitch WEnd ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-size Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Switch BitAND($wParam, 0xFFFF) Case 0 ; SIZE_RESTORED If Not $Restored Then ConsoleWrite("Window was restored" & @LF) $Restored = True Case 1 ; SIZE_MINIMIZED ConsoleWrite("Window was minimized" & @LF) $Restored = False Case 2 ; SIZE_MAXIMIZED ConsoleWrite("Window was maximized" & @LF) $Restored = False EndSwitch Return "GUI_RUNDEFMSG" EndFunc1 point
-
@Lion66 Just add a flag to track when the window is in a minimized state -- #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> Global $bMinimized = False $hGUI = GUICreate("Test", 640, 480, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_OVERLAPPEDWINDOW)) $Button1 = GUICtrlCreateButton("Maximize", 80, 56, 113, 33) GUISetState() GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 WinSetState($hGUI, "", @SW_MAXIMIZE) Sleep(1000) WinSetState($hGUI, "", @SW_RESTORE) EndSwitch WEnd ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-size Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) Switch BitAND($wParam, 0xFFFF) Case 0 ; SIZE_RESTORED If $bMinimized Then $bMinimized = False ConsoleWrite("Window was restored" & @LF) EndIf Case 1 ; SIZE_MINIMIZED ConsoleWrite("Window was minimized" & @LF) $bMinimized = True Case 2 ; SIZE_MAXIMIZED ConsoleWrite("Window was maximized" & @LF) Case 3 ; SIZE_MAXSHOW ConsoleWrite("SIZE_MAXSHOW" & @LF) Case 4 ; SIZE_MAXHIDE ConsoleWrite("SIZE_MAXHIDE" & @LF) EndSwitch Return "GUI_RUNDEFMSG" EndFunc Note that this doesn't handle the situation where a maximized window is minimized then restored.1 point
-
Splash Screen with Transparency
teodoric666 reacted to Skeletor for a topic
Hi All, I know many newbies search for this feature. I decided to share this piece of code with everyone. Basically its a "splash screen" that has a transparent image. In a nutshell - Gui with a transparent gif. Enjoy... Download attachment.... Splash Screen GUI.zip1 point -
I don't think so, so what about you do not interfere when I am trying to help this member to find the real cause? @Mattw11486, Strange as it seems that the setting fields for the hotkeys are both empty. Couple of questions: Did above post contain the exact scriptsource you have this issue with, so no #Directives to set these hotkeys? Do you have any settings in AutoIt3Wrapper.ini on the pc with the issue for?: SciTE_STOPEXECUTE SciTE_RESTART Jos EDIT: Please used the updated AutoIt3Wrapper.au3 version from Beta and show me what that generates, as the error message was not totally correct in case of failure.0 points