Jump to content

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

Stupid problem RE: mouse position relativity


  • Please log in to reply
27 replies to this topic
Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Okay, I'm a turbo novice at AHK, and I'm still learning the basics. However, what has me stumped is that I'm using a very simple script at my work computer that does exactly what I expect and want it to, but when copied directly to my home computer does not produce the same results.

 

#IfWinActive, ahk_class ShockwaveFlash
Tab::
Click 650, 575, 3
send +{Click 650, 575, 1}
Click 250, 200, 0
Return
 

My work computer recognizes and operates under the assumption that I want mouse position relative to the active window. My home computer assumes I want it relative to the entire screen.

 

The obvious option (to me anyway) was to try putting

 

CoordMode,Mouse,Relative

 

At the start of the script, but it did absolutely nothing. No error, no change, nothin'.

I'm mostly just confused as to how it would change from work to home barring an issue with OS (XP at work, 7 and home) or monitor resolution.

 

Thoughts?

Any help would be greatly appreciated. <3



GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

Try

CoordMode, Mouse, Window (or Client)  [v1.1.05+]

 

or

 

#IfWinActive, ahk_class ShockwaveFlash
::

CoordMode, Mouse, Window
Click 650, 575, 3

...



Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Tried it with a number of variations of that including:

 

CoordMode, Mouse, Window [v1.1.05+]

CoordMode, Mouse, Client [v1.1.05+]

CoordMode, Mouse, Window

CoordMode, Mouse, Client

 

None of those solved the problem with the script. It still detects as though the entire screen was the default selection method.



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

According to the doc, both computers use coordinates relative to the active window.

 

 

CoordMode

If this command is not used, all commands except those documented otherwise (e.g. WinMove and InputBox) use coordinates that are relative to the active window.

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).

 

Are you running the same Windows version on both machines ?


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

I'm using XP at work and Windows 7 at home.

 

However, as you point out, the default should be relative to the active window, and even if it wasn't, I have specified for it to use the active window for mouse position.

That's why I'm so stuck here. =/



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

In the FAQ of the doc, you can find this :

 

 

Why does my script run fine in XP but not in Vista or Windows 7 or 8?

A common problem when moving from XP to Vista or a later version of Windows is that programs which are "elevated" (run as administrator) block hotkeys or refuse to be automated. There are at least three workarounds:


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Running the script as administrator did not fix the issue.



Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

EDIT: Double post - (Deleting)



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

I'm not expert of Hotkey nor HotString, but what key are pressing to trigger the action ?

#IfWinActive, ahk_class ShockwaveFlash
::

Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Sorry, that was a problem I'd caused trying to see if the keypress was the issue.

 

My existing script reads

#IfWinActive, ahk_class ShockwaveFlash
Tab::
Click 650, 575, 3
send +{Click 650, 575, 1}
Click 250, 200, 0
Return
 

 

Woops



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

Did you check that the coordinates are valid in the target window ? You probably did it already, it is just to be sure.


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Yup. It's the same window and it has the same window dimensions/coordinates between both PCs.



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

And the same ahk_class ? The class name is case-sensitive.


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)


Janube
  • Members
  • 14 posts
  • Last active: Mar 29 2014 01:46 AM
  • Joined: 24 Mar 2014

Yup.

 

The script functions, it's just pretending that my screen is the default standard for mouse position.

The script, properly, does not function outside of Flash.



Oldman
  • Members
  • 2475 posts
  • Last active: Feb 18 2015 04:57 PM
  • Joined: 01 Dec 2013

If your script is running, now.

Show the taskbar and double-click on the tray icon from the script (a green H).

Activate the ShocwaveFlash window and press the tab key 2 or 3 times with 1 or 2 seconds delay.

Go back to the AutoHotkey debugger and press F5.

If you can see the commands from the script, that means the hotkey is triggered otherwise it's not.


Si ton labeur est dur et que tes résultats sont minces, souviens toi du grand chêne qui avant n'était qu'un gland....comme toi ! (anonyme) ;)

L'art de lire, c'est l'art de penser avec un peu d'aide. (É. Faguet)

Windows 3.1. Collector's Edition.     (www.avaaz.org)