 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tactical64
Joined: 21 Oct 2009 Posts: 4
|
Posted: Wed Oct 21, 2009 6:32 pm Post subject: issue with missed clicks |
|
|
I am in the process of writing a script to fully run malware bytes, and remove items found. The script works perfectly on my windows 7 64bit pc, it is fully compatible with XP also. My screen resolution changes dont seem to affect my coordinates, but when i run this on another pc some of the clicks are missed, yet using the windows spy shows on my computer the same coordinates that i have scripted. On the XP computer i see different coordinates.
My question is do different screen resolutions affect clicking, and what might my problem be. Script below, please guys this is my first autohotkey script so bear with me.
| Code: | RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Malwarebytes' Anti-Malware, terminateie, 00000001 ; sets program options
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Malwarebytes' Anti-Malware, autosavelog, 00000001 ; sets program options
;RunAs, Administrator, passwordhere
Run, "C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" ; opens malwarebyes
Sleep, 5000 ; pauses script for 5s
WinWait Malwarebytes' Anti-Malware ; waits for application to start fully
WinActivate ; sets focus to the program, uses last found window referenced by WinWait
IFWinExist Malwarebytes' Anti-Malware ; test that program is open
SetControlDelay, 1000 ; sets mouse clicks to 1s between clicks
{
Click 183, 128 ; clicks update tab
Sleep, 1000
Click 108, 329 ; clicks Check for Updates
}
WinWaitActive ahk_class #32770 ; waits for this class window to appear, it appears for updates and no updates
Sleep, 1000
IfWinActive,,You have the latest database version ; no updates found
{
Click 248, 133
}
else
{
Click 416, 133 ; Clicks ok on update window ; updates found
}
Sleep, 2000
{
Click 51, 130 ; clicks Scanner Tab
Sleep, 1000
}
{
Click 31, 268 ; clicks Perform quick scan 340 ; clicks Perform Full Scan button
Sleep, 1000
Click 87, 424 ; clicks Scan button
}
WinWaitNotActive ahk_class ThunderRT6FormDC ; waits till the scan form isnt active, it wont be active when the next message
appears
IfWinNotActive ahk_class #32770
WinActivate
IfWinActive,,No malicious items were detected ; checks for window that means no spyware
{
Click 418, 133 ; clicks OK that no spyware was found
Sleep, 1000
WinWaitActive ahk_class Notepad ; waits for log to display
WinKill ahk_class Notepad ; closes the logfile displayed in notepad
WinActivate ahk_class ThunderRT6FormDC ; sets focus back to malware bytes main window
Sleep, 1000
Click 705, 562 ; nothing to remove, close the program
}
else
IfWinActive,,Show Results ; checks for Show Results text meaning spyware was found
{
Click 408, 133 ; clicks OK on the found dialoge
Sleep, 1000
Click 680, 512 ; clicks Show Results
Sleep, 1000
Click 96, 514 ; clicks Remove Selected
}
WinWaitActive ahk_class Notepad ; waits for log to display
WinKill ahk_class Notepad ; closes the logfile displayed in notepad
WinActivate ahk_class #32770 ; sets focus back to the reboot prompt
WinWaitActive,,All selected items removed successfully
Sleep, 1500
{
Click 332, 134 ; clicks Yes to restart
}
ExitApp |
[Moved from Scripts & Functions forum. ~jaco0646] |
|
| Back to top |
|
 |
hugov
Joined: 27 May 2007 Posts: 2181
|
Posted: Wed Oct 21, 2009 7:30 pm Post subject: |
|
|
Instead of relying on clicks try to send either letters (sometimes you can type alt-letter to active a checkbox or button) or use the various control commands http://www.autohotkey.com/docs/commands.htm to click buttons, active checkbox etc this will work regardless of screenres. You can find the ahk_class with the window spy (right click the AHK icon in your systray) _________________ Tut 4 Newbies
TF : Text file & string lib, TF Forum |
|
| Back to top |
|
 |
tactical64
Joined: 21 Oct 2009 Posts: 4
|
Posted: Thu Oct 22, 2009 4:43 pm Post subject: |
|
|
Thanks HugoV, that worked for me, Below is my newest script for this program. I think its done, just a little more testing to do.
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Malwarebytes' Anti-Malware, terminateie, 00000001 ; sets program options
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Malwarebytes' Anti-Malware, autosavelog, 00000001 ; sets program options
Run, "C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe" ; opens malwarebyes
Sleep, 5000 ; pauses script for 5s
WinWait Malwarebytes' Anti-Malware ; waits for application to start fully
;WinActivate ; sets focus to the program, uses last found window referenced by WinWait
IFWinExist Malwarebytes' Anti-Malware ; test that program is open
;SetControlDelay, 1000 ; sets mouse clicks to 1s between clicks
ControlClick, Check for Updates, ahk_class ThunderRT6FormDC ; clicks Check for Updates,note this is on another tab
WinWaitActive ahk_class #32770 ; waits for this class window to appear, shows for updates and no updates
Sleep, 1000
IfWinActive,,You have the latest database version ; no updates found
ControlClick, OK, Malwarebytes' Anti-Malware ; clicks OK that no updates were found
else
ControlClick, OK, ahk_class #32770 ; updates found
Sleep, 1000
ControlClick, Perform full scan, Malwarebytes' Anti-Malware ; clicks Perform Full Scan Option
Sleep, 1000
ControlClick, Scan, Malwarebytes' Anti-Malware
Sleep, 1500
ControlClick, Start Scan, Perform full scan ; clicks Start Scan with default selections
WinWaitNotActive ahk_class ThunderRT6FormDC ; waits till the scan form isnt active,wont be active when the next message appears
IfWinNotActive ahk_class #32770
WinActivate
IfWinActive,,No malicious items were detected ; checks for window that means no spyware
{
ControlClick, OK, ahk_class #32770 ; clicks OK that no spyware was found
Sleep, 1000
WinWaitActive ahk_class Notepad ; waits for log to display
WinKill ahk_class Notepad ; closes the logfile displayed in notepad
WinActivate ahk_class ThunderRT6FormDC ; sets focus back to malware bytes main window
Sleep, 1000
ControlClick, Exit, Malwarebytes' Anti-Malware ; nothing to remove, close the program
}
else
IfWinActive,,Show Results ; checks for Show Results text meaning spyware was found
{
ControlClick, OK, ahk_class #32770 ; clicks OK on the found dialoge
Sleep, 1000
ControlClick, Show Results, ahk_class ThunderRT6FormDC ; clicks Show Results
Sleep, 1000
ControlClick, Remove Selected, ahk_class ThunderRT6FormDC ; clicks Remove Selected
}
WinWaitActive ahk_class Notepad ; waits for log to display
WinKill ahk_class Notepad ; closes the logfile displayed in notepad
WinActivate ahk_class #32770 ; sets focus back to the reboot prompt
WinWaitActive,,All selected items removed successfully
Sleep, 1500
ControlClick, Yes, ahk_class #32770 ; clicks yes to restart after spyware removal
ExitApp |
|
| Back to top |
|
 |
tactical64
Joined: 21 Oct 2009 Posts: 4
|
Posted: Thu Oct 22, 2009 7:50 pm Post subject: |
|
|
NOTE: This script is intended for home use only.
ALso, the next to last line of code reads
ControlClick, Yes, ahk_class #32770 ; clicks yes to restart after spyware removal
Change to
ControlClick, &Yes, ahk_class #32770 ; clicks yes to restart after spyware removal
THis is working great on home computers  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|