Scottswan Posted May 14, 2010 Posted May 14, 2010 This little script is for game shortcuts (and to save my mouse clicker). It runs great on XP with a dual core cpu, but on a P4 3.06ghz single core with XP the mouse moves are painfully slow. I was wondering if there is a way to optimize the mouse move code to speed it up a bit. Also I now need to double the number of moves, and the current code will probably get even slower. Maybe instead of calling each new position I could use an array? I'm not very advanced at coding. expandcollapse popup; Some global keys. HotKeySet("{ESC}", "Quit") HotKeySet("`", "Triclick") ;tilde key HotKeySet("!z", "HarvestDL") ;Alt + z HotKeySet("!x", "HarvestDR") ;Alt + x HotKeySet("!a", "HarvestUL") ;Alt + a HotKeySet("!s", "HarvestUR") ;Alt + s ;Click the mouse 3 times. Func Triclick() MouseClick("primary", default, default, 1, 100) Sleep(50) MouseClick("primary", default, default, 1, 100) Sleep(50) MouseClick("primary", default, default, 1, 100) EndFunc ;Harvest down and to the left 5 times. Func HarvestDL() $xpos = MouseGetPos(0) $ypos = MouseGetPos(1) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) EndFunc ;Harvest down and to the right 5 times. Func HarvestDR() $xpos = MouseGetPos(0) $ypos = MouseGetPos(1) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos + 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) EndFunc ;Harvest up and to the left 5 times. Func HarvestUL() $xpos = MouseGetPos(0) $ypos = MouseGetPos(1) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos - 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) EndFunc ;Harvest up and to the right 5 times. Func HarvestUR() $xpos = MouseGetPos(0) $ypos = MouseGetPos(1) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) $xpos = $xpos + 55 $ypos = $ypos - 30 MouseMove ($xpos, $ypos) Sleep(50) MouseClick("primary", default, default, 1, 100) EndFunc ; Run endless loop to keep script alive. While 1 Sleep(10) WEnd Func Quit() Exit EndFunc Thanks! -Scott
water Posted May 14, 2010 Posted May 14, 2010 Use MouseMove(x,y,0)This will move the mouse without delay. BTW: The help file is your friend My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Scottswan Posted May 15, 2010 Author Posted May 15, 2010 Use MouseMove(x,y,0)This will move the mouse without delay. BTW: The help file is your friend Thanks, that made a big difference on the slow PC. I can't even see the movement, but it still works. -Scott
K711 Posted July 11, 2010 Posted July 11, 2010 Use MouseMove(x,y,0)This will move the mouse without delay. BTW: The help file is your friend I have the same exact problem, however MouseClick("left",x,y,clicks,SPEED set to 0) still is Very slow. Even mouse moves are EXTREMELY slow. This same file runs lighning fast on my quad core Win XP machine. I am running it on a flash game. Whats strange is If I run it on the blank desktop it is super fast. It used to work fine, now its doing this. I have tried, different versions of flash, system resore all the way back to initial win xp install, windows updates in stages from Sp1/IE6 to SP3/IE8. Re-installed video drivers. I am at a wall! Please any ideas would help! Thank you!
tweaker Posted July 13, 2010 Posted July 13, 2010 I have the same exact problem, however MouseClick("left",x,y,clicks,SPEED set to 0) still is Very slow. Even mouse moves are EXTREMELY slow. This same file runs lighning fast on my quad core Win XP machine. I am running it on a flash game. Whats strange is If I run it on the blank desktop it is super fast. It used to work fine, now its doing this. I have tried, different versions of flash, system resore all the way back to initial win xp install, windows updates in stages from Sp1/IE6 to SP3/IE8. Re-installed video drivers. I am at a wall! Please any ideas would help!Thank you!One thing to take into consideration is the actual speed of the mouse from the OS layer. Go into Control Panel, Mouse, Pointer Options and set your speed to Fast. See if that speeds things up for you.
Ascend4nt Posted July 13, 2010 Posted July 13, 2010 You can also modify the AutoIT 'Opt' settings for 'MouseClickDelay' and 'MouseClickDownDelay' (lookup 'Opt' in Help) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now