Skip to content

Instantly share code, notes, and snippets.

@tenuki
Created August 26, 2021 07:28
Show Gist options
  • Save tenuki/acc8ac84b461450dfd0ac6fece36e351 to your computer and use it in GitHub Desktop.
Save tenuki/acc8ac84b461450dfd0ac6fece36e351 to your computer and use it in GitHub Desktop.
Metamask auto confirm with AutoIt 3 for firefox!
#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>
Local $win = "Extension: (MetaMask) - MetaMask Notification — Mozilla Firefox";
Local $endwin = "Example Domain — Mozilla Firefox";
ConsoleWrite("Ready to go.." & @CRLF)
Do
If WinWait($win, "", 1) > 0 Then
ConsoleWrite("FOUND!!!" & @CRLF)
; Test if the window is activated and display the results.
If WinActivate($win, "") Then
;MsgBox($MB_SYSTEMMODAL + $MB_ICONWARNING, "Warning", "Window activated" & @CRLF & @CRLF & "May be your system is pretty fast.")
Else
; Notepad will be displayed as MsgBox introduce a delay and allow it.
ConsoleWrite("Window dissappeared! This is strange!");
EndIf
Local $wp = WinGetPos ($win);
MouseClick($MOUSE_CLICK_LEFT, $wp[0]+10, $wp[1]+10)
MouseClickDrag($MOUSE_CLICK_LEFT, $wp[0]+10, $wp[1]+10, $wp[0]+10, $wp[1]+100)
MouseWheel($MOUSE_WHEEL_DOWN, 40)
MouseClick($MOUSE_CLICK_LEFT, $wp[0]+(($wp[2]*3)/4), $wp[1]+$wp[3]-30)
Sleep(500);
While WinWait($win, "", 1) > 0
Sleep(100);
WEnd
ConsoleWrite("end of wait" & @CRLF)
Else
Sleep(200)
If WinWait($endwin, "", 1) > 0 Then
Exit
EndIf
EndIf
Until False;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment