Please help me with Auto Hotkey script

Whatever...

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Víctor Paredes
Site Admin
Posts: 5648
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Please help me with Auto Hotkey script

Post by Víctor Paredes »

Hi everyone. I have been looking for long with no luck for a software to make a very specific task. Now I'm thinking maybe I don't need a software, but an Auto Hotkey script.
The problem is I don't know anything about script writing, so I thought maybe some of you could help me with it.

Here is the issue:
I work on a Lenovo X220 tablet PC. It's a laptop you can turn back and draw over the screen, similar to a Cintiq. It's a very nice computer and I always recommend it.
But many times, because the screen is small, I need to work with another Screen plugged to it. And here is a problem. Since the pen works only on the main screen, the only way I have to control the second monitor is by using a normal mouse.
It makes the work, but it's slow and not comfortable to work always switching from pen to mouse and from mouse to pen.

Here is my idea to solve it:
I'm think in a script that would make the tablet work as a "wacom" for the second monitor. So, with the script activated, I move the pen over the tablet screen, but the arrow is on the second screen.
My idea is to have a shortcut to switch between tablet and second screen. For example, if I press "#" or "F3" or any key, the pen now works as a wacom for the second monitor. If I press the shortcut again, the pen now works normally.

I'm not sure about how hard would be to write something like that or if it's even possible. It would be great if you would give me some help or feedback to get it.

Thank you very much.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
slowtiger
Posts: 6076
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: Please help me with Auto Hotkey script

Post by slowtiger »

I'm not so sure if this would be possible by a simple script. Recognizing mouse position is one of the most basic tasks of the operating system, so any meddling with it would need deep access into the system. And I'm sure if it were easy to implement we'd have heard about it.
AS 9.5 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
AS 11 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
Moho 13.5 iMac Quadcore 2,9GHz 16GB OS 10.15

Moho 14.1 Mac Mini Plus OS 13.5
F.M.
Posts: 497
Joined: Thu Nov 04, 2004 4:29 pm
Location: Between my ears

Re: Please help me with Auto Hotkey script

Post by F.M. »

Sort of like an echo.
"and then Man created god!"
User avatar
synthsin75
Posts: 9964
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Please help me with Auto Hotkey script

Post by synthsin75 »

I've done a LOT of AutoHotkey scripting over the past couple of years, both for work and for my own laptop. For instance, I use a video game emulator and I didn't like switching between my gamepad controller and the mouse/trackpad. So I wrote an AHK script to make the game controller act as a mouse outside of the emulator. I use a very rarely used button on the controller to switch between mouse and game control.

That sounds vaguely similar to what you are looking for, but not exactly.

When you use the mouse do you have to drag the cursor from your main screen over to the second screen?
User avatar
Víctor Paredes
Site Admin
Posts: 5648
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Please help me with Auto Hotkey script

Post by Víctor Paredes »

Thanks for the answers.

Synth, it's great to read you have worked on AutoHotkey. I would love to have the knowledge to play with it, I envy people who can make changes to their computers to get whatever they want. That's the whole idea of this machines, right?

When I'm using the mouse, I have to drag it from one window to the other. If I drag my mouse to the left, I get the second monitor and viceversa. It's like an extension of the desktop.
Some time ago I got a software which made the arrow jump from one laptop monitor to the second one. I thought it could be the solution, but that change was only temporal and useless for me. Once I put the pen over the laptop screen, the arrow went back to that screen. So it wasn't changing the mouse behavior, it only moved the arrow to certain fixed position.

From my ignorance, I'm thinking in two options:

To calculate the position of the mouse arrow by percentage. So, If the pen is in the middle of the laptop monitor (X50%, Y50%), it will be showed in the middle of the second monitor. I think it would be a fantastic solution, because it would work for any monitor at any resolution and it would be useful for anyone, even using a wacom.
But I don't know if to transform the arrow position to a percentage and translate it to a second monitor is even possible.

Maybe the simplest solution is a script that offset the arrow position in relation to the pen position. So, for example, if the pen is over the pixels X100 and Y100, the arrow could be over X-2000 Y100.
The problem I see with it is that when the second monitor resolution is bigger than the laptop one, you wouldn't be able to cover the entire monitor with the pen (because the movement would be 1:1 in terms of pixels). The only solution I see is to stretch the pen movement to cover the entire movement, but again, I don't know if it's possible.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
synthsin75
Posts: 9964
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Please help me with Auto Hotkey script

Post by synthsin75 »

For a non-programmer, you always seem to have a pretty good grasp of the issues involved, Selgin. Yep, my first idea was a mouse offset, but as well as the different screen resolutions, you also have to contend with which direction the mouse has to go to get to the second monitor.

I found a script last night that I might be able to modify to do the job. I'll check it out after work.
User avatar
synthsin75
Posts: 9964
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Please help me with Auto Hotkey script

Post by synthsin75 »

Well, what I found is only part of what you need, so it'll take me a while to sort out the rest.
User avatar
Víctor Paredes
Site Admin
Posts: 5648
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: Please help me with Auto Hotkey script

Post by Víctor Paredes »

Thank you very much, Synth.
I think here in the forum I have learned to empathize with programmers. Once I understood it's not just "magic", I try hard to think in a logic way to get something and try to talk in the same language.
The same happens with the beta forum. It's not just about asking for a feature, you have to imagine how it would work, what logic steps should follow. I always remember the pre smart bones discussion, it's fantastic how all that ideas and discussions finally lead to the "magic".
Thanks again, Synth. I will be waiting for any new.
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
Post Reply