Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[solved] Mousemove doens't work at all


  • Please log in to reply
16 replies to this topic
swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010
Hi,

maybe i'm just too dumb but i expect

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory

CoordMode, Mouse, Screen
MouseMove, 100, 100

to move my mousepointer to x=100, y=100 on my screen. But nothing happens. I tried "DllCall("SetCursorPos", int, 100, int, 400)" but got no result either. I feel like i'm missing something very obvious but i just can't figure it out. This is Windows XP in VirtualBox, can this be the problem?

Thank you

Carcophan
  • Members
  • 1578 posts
  • Last active: Nov 27 2013 06:46 PM
  • Joined: 24 Dec 2008
Works for me.

You sure that you are not accidently moving the mouse yourself after the script has? I tested your script for fun, and it moved to 100, 100.

fischgeek
  • Moderators
  • 1074 posts
  • Last active: Jul 07 2015 06:27 PM
  • Joined: 20 Apr 2009
Works for me too. Are you wanting it to move in the active window or the screen?

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010
i added a "sleep 1000" before the mousemove to test your suggestion, but still no result. Thank you for your help

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010

Works for me too. Are you wanting it to move in the active window or the screen?


I currently just want to move it at all. As far as i understand my code should move it relative to my screen, not the window

Murx
  • Guests
  • Last active:
  • Joined: --
Within a game?

fischgeek
  • Moderators
  • 1074 posts
  • Last active: Jul 07 2015 06:27 PM
  • Joined: 20 Apr 2009
Try adding this to your script
^!::Reload
Then, simply put this at the top of your script ...
MouseMove, 100, 100
Save your script, downsize all your windows and press Ctrl+Alt+R to reload the script to see if it actually works. It might not work if you're doing this in a game like Murx asked.

OceanMachine
  • Members
  • 790 posts
  • Last active: Aug 23 2013 02:10 PM
  • Joined: 15 Oct 2007
It looks like it's a virtualised windows install (VirtualBox? <!-- m -->http://www.virtualbox.org/<!-- m -->)

It may have the same drawbacks though?

Also, I think there was a typo in your example code Jeremiah (missing r?):
^![color=red]r[/color]::Reload


swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010

Within a game?


no, just plain windows xp

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010

Save your script, downsize all your windows and press Ctrl+Alt+R to reload the script to see if it actually works. It might not work if you're doing this in a game like Murx asked.


Still doesn't work. I see the mousepointer flicker but not moving.

Thank you for your help everyone btw.

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010

It looks like it's a virtualised windows install (VirtualBox? <!-- m -->http://www.virtualbox.org/<!-- m -->)


(i've fixed the typo)

Yes, it's a virtualised windows. I can't think of a reason why this should produce this behavior but currently that's my best bet.

fischgeek
  • Moderators
  • 1074 posts
  • Last active: Jul 07 2015 06:27 PM
  • Joined: 20 Apr 2009

Also, I think there was a typo in your example code Jeremiah (missing r?):

Yes, thank you :) -- Yeah, If that didn't work, I'm at a loss. Sorry. Maybe someone else has a better idea why this isn't working. Do other simple scripts work? Or other mouse scripts?
MouseClick, L, 100, 100


Carcophan
  • Members
  • 1578 posts
  • Last active: Nov 27 2013 06:46 PM
  • Joined: 24 Dec 2008
Sample Date: As a test, can you try to use pixelgetcolor, or pixelsearch? see if the mouse responds with the colors as needed?

Or, in addition to your 'mousemove', add a left click command to it too, so you move the mouse to X Y and then leftclick to bring up context menu (if it exists at that location i mean).

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010
i tried sending a mouseclick like that:

CoordMode, Mouse, Screen 
sleep 1000
MouseMove, 1000, 300
MouseClick , R

which is working in that i see the context menu opening. But the cursor still remains where it was. Removing mousemove and doing the movement in mouseclick produces the same behavior.

I tried another script which utilizes mousemove (<!-- m -->https://ahknet.autoh... ... igator.ahk<!-- m -->) and got the same result. mousemove commands are ignored (i added a msgbox before the mousemove to verify that it's called). So it seems to be a problem with my ahk or virtualized windows installation. I tried reinstalling ahk without result (i used a custom build for better array handling).

Right now i don't know which way to go from here. I don't have the chance to use a native windows install. Does anyone have any experience with ahk and virtualbox?

swarsron
  • Members
  • 10 posts
  • Last active: Feb 10 2010 01:45 PM
  • Joined: 08 Feb 2010
another quick note: i tried it in a fresh install of windows XP inside of VirtualBox in case the other instance has some kind of strange problem. I see the same behavior there