How do I have the mouse move to a pixel position | Autoit - autoit

So, do you know how I could have the mouse go to the position of a pixel (that moves) as soon as it sees it ?
https://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm was already tried, what I would need is a way to have the cooridinates replaced with the location where the pixel were found.

$coord = PixelSearch( 760, 50, 970, 95, 0x16AB39 )
MouseClick('left',$coord[0],$coord[1])

Related

How to draw to the full window in rgl?

I am drawing 4 subfigures in rgl to a window, and I would like them to fill the available space:
library(rgl);
rgl::open3d(windowRect = c(0,50, 1200, 1200));
rgl::mfrow3d(2, 2);
rgl::next3d(reuse=FALSE);
rgl::bg3d("yellow");
rgl::next3d(reuse=FALSE);
rgl::bg3d("blue");
rgl::next3d(reuse=FALSE);
rgl::bg3d("red");
rgl::next3d(reuse=FALSE);
rgl::bg3d("green");
However, the result uses only a tiny potion of the window, it looks like this:
How can I make the 4 colored areas span the whole window, instead of only using the tiny part in the lower left corner?
It tools me hours, but I have finally managed to get this to work reliably by myself. It seems you have to call par3d() after open3d().
Also note the call to Sys.sleep, as suggested by user20650 in the comments above. Without it, the window only gets drawn in full size after clicking on it (on my machine?).
Full working code:
rgloptions = list("windowRect"=c(50,50,1000,1000));
rgl::open3d();
do.call(rgl::par3d, rgloptions);
Sys.sleep(1);
rgl::mfrow3d(2, 2);
rgl::next3d(reuse=FALSE);
rgl::bg3d("yellow");
rgl::next3d(reuse=FALSE);
rgl::bg3d("blue");
rgl::next3d(reuse=FALSE);
rgl::bg3d("red");
rgl::next3d(reuse=FALSE);
rgl::bg3d("green");
This gives the following output reliably:
I'm not sure if this is an exact solution that you're looking for, but running your code as a function has worked for me.
make_box <- function(){library(rgl)
rgl::open3d(windowRect = c(0,50, 1200, 1200))
rgl::mfrow3d(2, 2)
rgl::next3d(reuse=FALSE)
rgl::bg3d("yellow")
rgl::next3d(reuse=FALSE)
rgl::bg3d("blue")
rgl::next3d(reuse=FALSE)
rgl::bg3d("red")
rgl::next3d(reuse=FALSE)
rgl::bg3d("green")}
make_box()

how to tint/highlight qpixmap only the area that has non-zero alpha

I have a QPixmap that has some transparent area. What can I do to apply a highlight/tint to only area that has non-zero alpha?
This is what I have right now, which tints the whole image.
QPixmap highlighedPixmap = myPixmap;
QPainter pixmapPainter;
pixmapPainter.begin(&highlighedPixmap);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_ColorDodge);
pixmapPainter.fillRect(highlighedPixmap.rect(), QColor(180, 180, 180, 100));
pixmapPainter.end();
input image:
expected result image:
The right option is CompositionMode_SourceAtop:
QPixmap highlighedPixmap = myPixmap;
QPainter pixmapPainter(&highlighedPixmap);
pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
pixmapPainter.fillRect(highlighedPixmap.rect(), foregroundColor);
pixmapPainter.end();
Within Qt directory in ...\examples\widgets\painting\composition, there is a "Composition Modes" tool, which lets you experiment with all composition modes. I found it in Qt 5.2.1 but it should be there at least since Qt 4.8.

AutoIT get child window from a parent window

I came across a problem which looks trivial to me but I can't find a valid solution after googling for an hour.
I want to fill in a window security popup window.
This is part of a selenium test, that can run in parallel next to other tests.
So in order to be sure that my autoit script fills in the correct popup (and not form another test that is running), i want to identify this popup as a child of a parent window. Is there an easy way to do this?
The code i had so far:
$browserHandl = WinWait($parentTitle)
WinActivate($browserHandl, "")
$popUpHandl = WinWait("Windows Security")
So my fear is that WinWait will return one of all the open Windows Security popups currently open on the machine.
So:
1. Is there a way to obtain the childwindows of a parent window when i got its handle?
2. Is my fear correct that i indeed will have a race condition with multiple tests running at the same time?
input box open
input box hidden
I used a progress to hide what I needed to.
add #include
$file = GUICtrlCreateInput("", 10, 5, 350, 25)
You need 3 lines for the Marquee
Local $iProgress = GUICtrlCreateProgress(30, 10, 270, 20, $PBS_MARQUEE)
GUICtrlSendMsg($iProgress, $PBM_SETMARQUEE, 1, 50)
and to make it cover the input box
and 0 to stop and remove the Marquee GUICtrlSendMsg($iProgress, $PBM_SETMARQUEE, 0, 50) ; Send the message $PBM_SETMARQUEE and wParam of 0 to stop the scrolling marquee.

GE plugin tethered placemark

I am trying to code a tethered placemark in the plugin just like the ones in google earth but I can't find any reference to a single line going from ground up to the pushpin.
Here is what I have so far: what am I missing?
var placemark = ge.createPlacemark("");
var point = ge.createPoint("");
point.setLatitude(41.0);
point.setLongitude(-88.0);
placemark.setGeometry(point);
point.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
point.setAltitude(500);
ge.getFeatures().appendChild(placemark);
Any help would be highly appreciated Thanks in advance.
You just need to set the extrude property of the KML point to true. i.e.
point.setExtrude(true);
This specifies whether to connect the geometry to the ground with a "tail" as you require.
It is also worth noting that for extrude to have any effect the altitudeMode of the point must be either relativeToGround, relativeToSeaFloor, or absolute.
Also, you can set the properties of the point using the shorthand set method. i.e.
// latitude, longitude, altitude, altitudeMode, extrude, tessellate
point.set(41, -88, 500, ge.ALTITUDE_RELATIVE_TO_GROUND, true, false);

Execute command when mouse touches screen edge in Awesome-wm

I'm new to doing custom lua for the rc.lua in Awesome and I'm having a bit of trouble working out how to launch something based on the mouse position. This is what I have, so-far, but it's not doing anything.
-- Open todo when mouse hits right screen edge.
todo_timer = timer({timeout = 0.1})
todo_timer:add_signal("todopopup", function()
if mouse.coords.x >= 3198 then
scratch.drop("urxvt -e vim /home/ryan/to-do", "center", "right", 0.33, 1, "true")
end
end)
todo_timer:start()
--
Instead of using a timer, you could/should use the mousegrabber like the following:
mousegrabber.run(function(mouse)
if mouse.x > 3196 then
-- Do your stuff here
end
-- Return true, to continue grabbing the mouse
return true
end)
The problem with that approach is, that you can only register one mousegrabber at a time. So this is a perfect solution, if you just need to listen shortly for that mouse movements. If you need longer, you could stop the grabbing when you need the grabber for something else (mainly client re sizing and moving) and start it, when that that is finished.
This almost works as intended. For some reason the scratchpad appears on screen 1 the first time and does not center vertically properly (this problem only occurs with a horizontal position of "right", I assume it's a problem with scratchpad), for me, but it should work for people who do not have a multi-monitor setup or for launching other commands of your choice.
-- Open todo when mouse hits right screen edge.
local function todopad()
scratch.drop("urxvt -e vimpager /home/ryan/to-do", "center", "right", .20, 800, "true", 2)
end
todo_timer = timer({timeout = 1})
todo_timer:add_signal("timeout", function()
if mouse.coords()["x"] >= 3196 then
todopad()
end
end)
todo_timer:start()
--

Resources