Jump to content

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

ControlClick Issue


  • Please log in to reply
14 replies to this topic
Unknovvn
  • Members
  • 4 posts
  • Last active: Jan 18 2018 07:32 AM
  • Joined: 06 Dec 2013

Hello, I have a script to swap the gear in a game by right click the item in the inventory.

It looks like there is an error if I hold down the LButton while I run the script. I guess it is the conflict between the LButton and RButton being pressed / queued at the same time. If I release the LButton physically or use a SendInput {LButton Up} before the swap, it runs perfectly fine.

 

Just wondering if there is a way for me to hold the LButton during the swap? I checked the ahk manual and tried all those SetControlDelay

things and no luck still. Regular MouseClick has the same issue as well.

 

Any input would be appreciated, thanks.



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

Have a look at the (*) wilcard modifier.

 

 

Fire the hotkey even if extra modifiers are being held down. This is often used in conjunction with remapping keys or buttons.


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)


Unknovvn
  • Members
  • 4 posts
  • Last active: Jan 18 2018 07:32 AM
  • Joined: 06 Dec 2013

Thanks oldman!

 

Sorry I am new to AHK, can you more specific? or are there any doc I can look at.



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

I've actually been looking for a way to send {space} to a minimized window without actually activating the window. Haven't been able to figure that one out as of yet



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

Thanks oldman!

 

Sorry I am new to AHK, can you more specific? or are there any doc I can look at.

 

This link.


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)


RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006

I assume you are playing the game at the same time, in other words the game window is active?

 

As you suspect, the issue is simply due to your mouse buttons being down. For example, its common for RTS games to ignore a right click if you are performing a box drag (left button down). Some games will respond differently to these situations. You can release the logically pressed keys and then restore them to the correct state after the automation. Creating a robust and completely unobtrusive macro/input system which doesn't interfere with user input is possible, but it's an advanced topic which takes considerable work and an intimate knowledge of how the game in question responds to input and game actions.



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

I've actually been looking for a way to send {space} to a minimized window without actually activating the window. Haven't been able to figure that one out as of yet

 

You can do that with the "ControlSend" command, link.


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)


scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

You can do that with the "ControlSend" command, link.

Tried it many times, but can't get it to go. I'm trying to send "space" to a miminimed Google Chrome window, and that window is a streaming music site, which I believe uses flashplayer to play its music. Spacebar pauses/unpauses the music, much like YouTube, where spacebar pauses/unpauses the video. I have the music playing in the background (minimied windwow) and to puase that music, I'd like to just tap spacebar and keep it minimied/inactive. The site is     http://www.mixcloud....bient-chillout/    if that makes any difference. Not sure if it's flashplayer that it's using to stream its music. Just hit the arrow on any tracklist to play it. 



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

You can do that with the "ControlSend" command, link.

Tried it many times, but can't get it to go. I'm trying to send "space" to a minimized Google Chrome window, and that window is a streaming music site, which I believe uses flashplayer to play its music. Spacebar pauses/unpauses the music, much like YouTube, where spacebar pauses/unpauses the video. I have the music playing in the background (minimized windwow) and to pause that music, I'd like to just tap spacebar and keep it minimized/inactive. The site is     http://www.mixcloud....bient-chillout/    if that makes any difference. Not sure if it's flashplayer that it's using to stream its music. Just hit the arrow on any tracklist to play it. 



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

Could you try like this ?

I tested it in Firefox, starting at the Mixcloud's Home page.

The X and Y position in the ControlClick have to be checked with Google Chrome.

I added another hotkey, to toggle the show/hide Mixcloud window.

If the window is just minimized and you press the space bar, the window opens and the music stop/start playing.

 

Launch the script first.

Open the Mixcloud home page in Google Chrome.

Press the hotkey to hide/show the window.

Press the space bar to stop/start playing the music.

 

I let you define an exit key.

DetectHiddenWindows, On
toggle := true
while !hWnd := WinExist("Ambient / Chillout category radio shows and DJ mixes | Mixcloud - Mozilla Firefox")
	Sleep, 1000
WinGetPos,,,, H, ahk_id %hWnd%
X := 90
Y := H - 35
return

Space::
ControlClick, x%X% y%Y%, ahk_id %hWnd%,,,, NA
return

F1::
if toggle := !toggle
	WinShow, ahk_id %hWnd%
else
	WinHide, ahk_id %hWnd%
return


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)


scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

thanks Oldman. Still can't get it to go though. Believe me, I've played around with this thing for weeks and it looks like there's no workaround for it. 

 

I've managed to do it by maximizing/activating the Mixcloud window, then send spacebar, then minimize it again - and it works. But not all the time; it's buggy. I was looking for a way to send spacebar to it while it's minimized (and in Google Chrome, I no longer use Firefox). I really don't think it's going to work though, for whatever reason. I've tried everything from controlclick to controlsend to everything else, and nothing has worked unless the window is active. 



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

On Windows XP, it works fine.

With Google Chrome you have to change the window title.

while !hWnd := WinExist("Ambient / Chillout category radio shows and DJ mixes | Mixcloud - Google Chrome")

If you are running Windows Vista, 7, 8 or 8.1 and it does not work, you could have a look at this link.


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)


scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

wow-this is actually starting to get somewhere... it works when the Mixcloud window is hidden (i.e. behind another window, but still maximized).. but it doesn't work when the Mixcloud window is minimized (down on the taskbar)... 

 

in other words, when the window is *not* visible anywhere on your screen and is also *not* minimized (which means it's just hidden behind another window), then pressing spacebar works. (Awesome). But when it's minimized, it isn't working... 



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

Yes, indeed, it doesn't work when the windows is minimized with Google Chrome.

With Firefox, it works.

That's why, I have used another hotkey to toggle the show/hide window.

When the window is hidden, it works.

Look at the script, you'll see the F1 hotkey.

If you press F1, the window disappears, even from the task bar.

If you press F1 again, the window appears.


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)


scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

I've implemented your code so it works nicely now - so: it first activates the mixcloud window (restores/shows it on the desktop), sends spacebar to it and then re-minimizes it back down to the taskbar. The difference here is that it's very fast and reliable. Even though it doesn't send {space} to the window when it's minimized, this certainly works just as well. Thanks :)