I decided that what I needed as a remedy for my dilemma of Mail not clickable, was to click on the desktop at the position of the required item. Easier said than done.
I found a page that described how do do this via an .h file, but when I compiled the attached file, it gave me an error and a warning. Also, I have no idea of where any compiled file might be located.
As I know nothing about the terminal commands, would someone who know about such things be able to guide me on what I need to do please.
The page contents and Terminal command are below. You need to save the contents to a text file rename ‘Click.m’, and also navigate to the file with the Terminal.
Command…
gcc -o click click.m -framework ApplicationServices -framework Foundation
Contents…
{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160
{\fonttbl\f0\fnil\fcharset0 Monaco;\f1\fnil\fcharset0 Verdana;}
{\colortbl;\red255\green255\blue255;\red140\green30\blue3;\red0\green0\blue38;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\qj
\f0\fs24 \cf2 \expnd0\expndtw0\kerning0
// File: \
// click.m\
//\
// Compile with: \
// gcc -o click click.m -framework ApplicationServices -framework Foundation\
//\
// Usage:\
// ./click -x pixels -y pixels \
// At the given coordinates it will click and release.\
\
\
#import <Foundation/Foundation.h>\
#import <ApplicationServices/ApplicationServices.h>\
\
\
int main(int argc, char *argv[]) \{\
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];\
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];\
\
\
// grabs command line arguments -x and -y\
//\
int x = [args integerForKey:@"x"];\
int y = [args integerForKey:@"y"];\
\
\
// The data structure CGPoint represents a point in a two-dimensional\
// coordinate system. Here, X and Y distance from upper left, in pixels.\
//\
CGPoint pt;\
pt.x = x;\
pt.y = y;\
\
\
// This is where the magic happens. See CGRemoteOperation.h for details.\
//\
// CGPostMouseEvent( CGPoint mouseCursorPosition,\
// boolean_t updateMouseCursorPosition,\
// CGButtonCount buttonCount,\
// boolean_t mouseButtonDown, ... )\
//\
// So, we feed coordinates to CGPostMouseEvent, put the mouse there,\
// then click and release.\
//\
CGPostMouseEvent( pt, 1, 1, 1 );\
CGPostMouseEvent( pt, 1, 1, 0 );\
\
\
[pool release];\
return 0;\
\}\
\pard\pardeftab720
\f1 \cf3 \expnd0\expndtw0\kerning0
Save the above code as
\f0 \cf2 \expnd0\expndtw0\kerning0
click.m
\f1 \cf3 \expnd0\expndtw0\kerning0
, open Terminal, and switch to the folder where you saved the source. Then compile the program by typing
\f0 \cf2 \expnd0\expndtw0\kerning0
gcc -o click click.m -framework ApplicationServices -framework Foundation
\f1 \cf3 \expnd0\expndtw0\kerning0
. Don't be intimidated by needing to compile this as there are more comments than code. It is a very short program that does one simple task. \cf0 \expnd0\expndtw0\kerning0
\
}