Comments (7)
The Ruby code is not very helpful in understanding the issue, but (as you write yourself), it basically seems to boil down to getting the cursor type – which is not difficult.
The question is if it would be sufficient to implement getting the cursor and writing it to STDOUT (so your code can read it and use that information to judge what would be the appropriate action), or if you’d rather expect cliclick to do something like “if the cursor is the resizeLeftRightCursor, click at 10:20, else click at 10:30”.
from cliclick.
sorry about the ruby...
I was originally looking for cursor detector code that I could call after calculating the target x,y.
As I still would need cliclick to move the mouse to trigger any cursor event, I thought it may be better if self contained...
I tried to write my thinking as a cliclick command example.
gc[:x,y,a,b,str] GET CURSOR will move the mouse to the point with the given coordinates and query cursor type given in the string. Example: “gc:12,34,-0,+5,resizeLeftRightCursor” will move the mouse to the point with x coordinate 12 and y coordinate 34 and returns true if cursor matches string, else it will move the mouse using values given in a,b and re-test. If a match is not found at any position return returns false.
AS a bonus, I think having it as part of cliclick would make it possible to avoid dragging none edges or clicking misplaced buttons when automating GUI testing.
thanks for your reply
john
from cliclick.
I wouldn’t want to add the logic part to cliclick, as the possible behaviors – and therefore command syntaxes – are endless. (For instance: someone might just want to write to STDERR and exit, if the cursor is not as expected, while somebody else might want to wait 10 seconds and check again, while a third person might want to check the cursor is one of 3 allowed types.)
However, as I wrote before, just reading and returning the cursor isn’t hard, and I think it would make sense to add it.
So, despite your “gc:” example above, I guess that would be something that could help you get the task done?
from cliclick.
just getting the active cursor would be very useful, and I can add my own logic in the ruby code...
I not a programer, I just write plugins for Sketchup,app to make it run better on a mac...
sometimes I was just over complicating my thoughts...
from cliclick.
As I wrote before, getting the current cursor is not difficult – well, at least theoretically …
The problem is, that as soon as I add [NSCursor currentSystemCursor]
to the code, it crashes:
NSLog(@"Supported: %@", [NSCursor respondsToSelector:@selector(currentSystemCursor)] ? @"Y" : @"N");
NSCursor *cursor = [NSCursor currentSystemCursor]; // <-- Causes SIGABRT
The stack suggests that the code tries to get a graphics context (calling [NSGraphicsContext currentContext]
returns nil
, which is not surprising), but doesn’t get one:
* thread #1: tid = 0xbdce, 0x00007fff91c4b212 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff91c4b212 libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff91ecbb24 libsystem_c.dylib`pthread_kill + 90
frame #2: 0x00007fff91f0ff61 libsystem_c.dylib`abort + 143
frame #3: 0x00007fff8f65e112 CoreGraphics`CGSConnectionByID + 232
frame #4: 0x00007fff8f7b8a1c CoreGraphics`CGSGetRegisteredCursorDataSize + 50
frame #5: 0x00007fff8c1f2d3e AppKit`+[NSCursor currentSystemCursor] + 61
* frame #6: 0x000000010000a751 cliclick`-[PrintCursorTypeAction performActionWithData:inMode:](self=0x0000000100114e60, _cmd=0x000000010000b829, data=0x0000000100013600, mode=0) + 225 at PrintCursorTypeAction.m:56
frame #7: 0x000000010000233e cliclick`+[ActionExecutor executeActions:inMode:waitingMilliseconds:](self=0x0000000100012fc8, _cmd=0x000000010000b7f7, actions=0x0000000100112230, mode=0, milliseconds=30) + 1230 at ActionExecutor.m:79
frame #8: 0x0000000100001769 cliclick`main(argc=2, argv=0x00007fff5fbffa20) + 1705 at cliclick.m:132
Unfortunately, I don’t have a clue about graphics contexts and how to create one without a window. I am now adding this comment, hoping that someone out there might be able to help out with this …
from cliclick.
does using currentCursor have the same issue?
NSCursor *cursor = [NSCursor currentCursor];
from cliclick.
No, it hasn’t, but it doesn’t help in identifying the global cursor.
from cliclick.
Related Issues (20)
- Fails silently when missing Accessibility permissions
- Cliclick is not working anymore HOT 2
- It doesn't seem to work on Xcode, I don't know if I formatted it wrong HOT 1
- Case in first character in type (`t:`) command is not respected HOT 2
- run with macOS "Shortcuts.app" HOT 3
- "The command terminated due to receipt of a signal." HOT 15
- How to schedule a task ? HOT 1
- sending spacebar to mpv HOT 2
- Hold down any key? HOT 3
- kp: doesnt work (MacOS 12.6.2) HOT 4
- -e option argument not applying to subsequent dm commands HOT 2
- Trouble sending to windowed application HOT 1
- cp:x,y HOT 1
- The "move" command doesn't work anymore (macOS Monterey 12.6.3) HOT 9
- Issue with move parameter and macOS Catalina HOT 5
- More options for mouse speed movement HOT 1
- Ventura 13.6 update - no longer recognizing cliclick codes HOT 3
- Key-list incomplete? HOT 2
- Right mouse button drag and scroll wheel HOT 2
- Relative coordinates don't work when trying to access point on external display HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cliclick.