I want to write a little vnc similar program that moves the Mac OS cursor to a position (x, y) given through a protocol which gets data from Bonjour service. The problem is that I don't know how to move the cursor!
I'm working with Cocoa.
You can be forgiven for not looking in Quartz Display Services for this one. The function you're after is CGWarpMouseCursorPosition.
Since the documentation doesn't say, you'll have to experiment to determine which co-ordinate system it uses—i.e., where the origin is and which way positive y goes.
Related
I want to develop an application that in one of the steps move the spark programmatically, something as “elevate during 1 second” or “move left during 5 seconds”, or maybe "move one meter to the left" this after pushing one button in the mobile application.
I’m unable to find this kind of functionalities in the API, or code examples.
The more similar functions are:
GoToAction(LocationCoordinate2D coordinate) or
GoToAction(float altitude)
My question is: This can be done? Or Can I move the spark without knowing the destination coordinates?
Shy of knowing the coordinates and using waypoints, you might want to consider virtual joystick.
Using virtual joystick you can move in a small fashion as using the controller, no destination location need. However, the caveat is that you must make movement calculations yourself in order to set the direction, speed, e.t.c.
I am working on developing program for autonomous control of DJI matrice drone. I like to have precise landing of DJI drone with tolerance of approx 5cm in X and Y axes. For this I am trying to control the drone until 50cm from ground and then immediately landing() function is called. But after the landing() function is called, I see that the drone moves in X and Y directions as well. Due to this landing within defined tolerance fails. Is there a way, that I may write an own code for autolanding program with different constraints.
Thanks.
you can use a combination of a few tools:
Use flightCtrl APIs such as positionAndYawControl documented here to command the drone in the z-axis, slowly reducing the z position desired
Monitor flight status using broadcast->getStatus() as documented here, and keep sending lower z-setpoints till the drone's flight status changes to M100FlightStatus::LANDING
Send disArm() command to turn the motors off and ensure that the status changes to M100FlightStatus::FINISHING_LANDING.
You might have to experiment a little with the z set points and the time duration to keep sending lower setpoints in order to get this to work.
My colleagues seem to have a lot of trouble using my AHK scripts and it sounds like the MouseClicks are not clicking the right positions within the active windows.
Both parties here are using Windows 7.
Their resolution is 1600 x 900 where as I'm using 1280 x 1024.
I thought the relative positions to a given window would be different so I got my IT people to get 16:9 monitors today for the computer next to mine. Unfortunately the monitors don't support 1600 x 900 resolution and when I noticed that I didn't check the coordinates on those monitors because it wasn't the right resolution.
I was looking around for another way to convert the coordinates to that resolution and found a thread that says converting my coordinates is as simple as:
x1 * 1600/1280 = x2
y1 * 900/1024 = y2
I applied this formula to the MouseClick command coordinates and I tested it on different resolutions and the clicks go to the wrong position everytime.
However, the regular coordinates from my starting resolution still work.
I'm not sure anymore if the coordinates are the problem which is why I'm here asking.
Thank you.
No. The coordinate system or point of origin is not affected by screen resolution, nor are the coordinates for the window itself.
However, the size or contents of the window may change depending on any number of factors, including screen resolution. It is up to the application.
Window coordinates (the default for most commands in AutoHotkey v1) depend on the current system theme and other settings which affect the size of the window's title bar and borders.
Client coordinates (the default for AutoHotkey v2) are less affected by differences between systems, so are recommended over Window coordinates.
Whatever the coord mode, any values you hard code in the script will need to take into account whatever changes in layout might occur within the application. Again, what those changes are depends on the application.
If the system has multiple monitors and they do not all have the same DPI (scaling), the system "lies" about the coordinates of objects on monitors other than the primary one, unless the program retrieving the coordinates is per-monitor DPI aware. This can cause issues with AutoHotkey, which is not per-monitor DPI aware.
Is it posible to get average color (or more) of the computer screen in real time on a Mac?
For example, if I'm watching this site it will probably be white. I'm trying to make very simple ambient light with Arduino.
I'm not a Mac developer, so I may be off the mark here, but I doubt Mac OS X provides a method specifically to get the average color of the screen. What you could do is take a screenshot and resize it down to one pixel using Core Image, which should efficiently (using hardware acceleration where available) calculate the average.
I need a simple Layout Manager that is UI agnostic. By this, I mean it should not specify how I want to represent my shapes/controls on the screen. It should just enable me to say:
I want shape X here.
I want shape Y under shape X.
I want shape Z to surround X, and isolate itself from shape Y.
I guess it would be nice if it can also give me (X, Y) for each shape when I am finished.
I am using .NET.
You could consider Windows Presentation Foundation
The Layout System