Re: Cliclick Fails on NON-Laptop Mavericks
Re: Cliclick Fails on NON-Laptop Mavericks
- Subject: Re: Cliclick Fails on NON-Laptop Mavericks
- From: Robert Poland <email@hidden>
- Date: Thu, 12 Dec 2013 07:06:12 -0700
On Dec 12, 2013, at 1:53 AM, koenig.yvan <email@hidden> wrote:
>
> Le 12/12/2013 à 02:04, Robert Poland <email@hidden> a écrit :
>
>> Hi,
>>
>> The script (below) no longer works on desktop computers running Mavericks. It does work on laptops.
>>
>> Running the script moves the cursor to the green button but does not click it.
>>
>> Running the command in Terminal does move to and click the button.
>>
>> So far the developer has no ideas.
>>
>> Any thoughts?
>>
>>
>> -- NOTE: THIS SCRIPT MAY DEPEND ON THE SATIMAGE.OSAX
>> -- NOTE: THIS SCRIPT MAY DEPEND ON CLICLICK
>> — http://www.bluem.net/en/mac/cliclick/
>>
>> on run
>> main()
>> beep
>> end run
>>
>> on main()
>> set applicationName to (info for (path to frontmost application))'s short name
>>
>> tell application applicationName
>> activate
>> try
>> set {leftEdge, topSide, null, null} to bounds of window 1
>> on error
>> beep 2
>> tell application "System Events"
>> display dialog "This function is broken when used with " & applicationName
>> end tell
>> end try
>>
>> if applicationName contains "Finder" then
>> set y to (topSide - 12) as integer -- locate green button
>> else
>> set y to (topSide + 12) as integer
>> end if
>> set x to (leftEdge + 52) as integer
>> delay 0.5 -- needs this value or greater
>> do shell script "cliclick c:" & x & "," & y -- click it
>> end tell
>> end main
>>
>> TIA,
>>
>> Robert Poland
>
>
> Hello Robert
>
> Are you sure that your script behaves well on laptops .
>
> You codd :
> do shell script "cliclick c:" & x & "," & y -- click it
> when you need to use :
>
> do shell script " cliclick c " & x & " " & y — in fact you control click it
>
> I really don’t guess what was the colon doing in your instruction
> The comma separating the two parameters is wrong.
>
> cliclick -h which if the table of law say:
>
> cliclick - Command Line Interface Click
> Version 1.3.1
> Carsten Bluem, 2010-04-13
> http://www.bluem.net/en/mac/cliclick/
>
> Usage: cliclick [-v] [-r] [-q] [-w n] x y [x2 y2] [x3 y3] [...]
> x and y are integer numbers which specify the screen coordinate(s)
> where the mouse click(s) should be emulated. (Upper left corner is 0 0)
> Instead of a number, you may pass "m" as x and / or value to
> use the current x and / or y position.
>
> If you need a doubleclick, prefix the x coordinate with "d".
> If you need a control click, use prefix "c".
>
> Options:
> -w <n> You can pass multiple coordinate pairs as argument. But if you do,
> it is often useful to have a small delay between events -- that is
> what the -w option is for: It will cause cliclick to wait for the
> specified number of milliseconds after each event.
> -q Instead of clicking, print the current mouse pointer.
> location on the screen (format "x,y") and exit.
> -r Restore initial mouse location after performing the clicks.
> -v Makes cliclick more verbose.
>
> Examples:
> 'cliclick 26 12' will click the apple menu
> 'cliclick 50 60 c70 80' will click at 50/60, then Control-click at 70/80
> 'cliclick d50 60' will doubleclick at 50/60
> 'cliclick dm m' will doubleclick the current mouse location
> 'cliclick c500 m' will control-click at x position 500 and
> the mouse's current y position.
> 'cliclick -w 50 26 11 26 33' will open the "About this Mac" panel
> 'cliclick -r 26 12' will click the apple menu and, afterwards,
> restore the initial mouse location.
> 'cliclick -q' will print the current mouse location.
>
>
> Yvan KOENIG (VALLAURIS, France) jeudi 12 décembre 2013 09:51:13
Thanks Yvan,
I trued your suggestion and got error, 'Smile got an error: Missing argument to command "c": Expected two coordinates (separated by a comma) or “.”.Examples: "c:123,456" or "c.”'
BUT you’re referring to a very old version. current version is 2.3.1. 10/17/2013.
USAGE
cliclick [-m <mode>] [-f <file>] [-w <num>] [-r] command1 [command2] [...]
OPTIONS
-r Restore initial mouse location when finished
-m <mode> The mode can be either “verbose” (cliclick will print a
description of each action to stdout just before it is
performed) or “test” (cliclick will only print the
description, but not perform the action)
-f <file> Instead of passing commands as arguments, you may instead
specify a file from which cliclick will read the commands.
Each line in the file is expected to contain a command
in the same format/syntax as commands given as arguments
at the shell. Additionally, lines starting with the hash
character # are regarded as comments, i.e.: ignored. Leading
and trailing whitespace is ignored, too.
-w <num> Wait the given number of milliseconds after each event.
If you find that you use the “wait” command too often,
using -w could make things easer. Please note that “wait”
is not affected by -w. This means that invoking
“cliclick -w 200 wait:500” will wait for 700 milliseconds.
The default (and minimum) value for -w is 20.
-d Send a donation
COMMANDS
To use cliclick, you pass an arbitrary number of commands as arguments.
A command consists of a command identifier (a string that tells cliclick
what kind of action to perform) and usually one or more arguments to the
command, which are separated from the command identifier with a colon.
Example: “c:123,456” is the command for clicking (the “c” is the command
identifier for clicking) at the position with x coordinate 123 and y
coordinate 456. See below for a list of all commands and the arguments they
expect.
Whenever a command expects a pair of coordinates, you may provide
relative values by prefixing the number with “+” or “-”. For example,
“m:+50,+0” will move the mouse 50 pixels to the right. Of course, relative
and absolute values can be mixed, and negative values are possible, so
“c:100,-20” would be perfectly valid. (If you need to specify absolute
negative values in case you have a setup with a second display arranged to
the left of your main display, prefix the number with “=”, for instance
“c:100,=-200”.)
LIST OF COMMANDS
c:x,y Will CLICK at the point with the given coordinates.
Example: “c:12,34” will click at the point with x coordinate
12 and y coordinate 34. Instead of x and y values, you may
also use “.”, which means: the current position. Using “.” is
equivalent to using relative zero values “c:+0,+0”.
m:x,y MOVE the mouse to the point with the given coordinates.
Example: “m:12,34” will move the mouse to the point with
x coordinate 12 and y coordinate 34.
dc:x,y Will DOUBLE-CLICK at the point with the given coordinates.
Example: “dc:12,34” will double-click at the point with x
coordinate 12 and y coordinate 34. Instead of x and y values,
you may also use “.”, which means: the current position.
tc:x,y Will TRIPLE-CLICK at the point with the given coordinates.
Example: “tc:12,34” will triple-click at the point with x
coordinate 12 and y coordinate 34. Instead of x and y values,
you may also use “.”, which means: the current position.
kd:keys Will trigger a KEY DOWN event for a comma-separated list of
modifier keys. Possible keys are:
“alt”, “cmd”, “ctrl”, “fn”, “shift”
Example: “kd:cmd,alt” will press the command key and the
option key (and will keep them down until you release them
with another command)
ku:keys Will trigger a KEY UP event for a comma-separated list of
modifier keys. Possible keys are:
“alt”, “cmd”, “ctrl”, “fn”, “shift”
Example: “ku:cmd,ctrl” will release the command key and the
control key (which will only have an effect if you performed
a “key down” before)
p[:str] Will PRINT the given string. If the string is “.”, the
current MOUSE POSITION is printed. As a convenience, you can skip
the string completely and just write “p” to get the current position.
Example: “p:.” or “p” will print the current mouse position
Example: “p:'Hello world'” will print “Hello world”
w:ms Will WAIT/PAUSE for the given number of milliseconds.
Example: “w:500” will pause command execution for half a second
kp:key Will emulate PRESSING A KEY (key down + key up). Possible keys are:
“arrow-down”, “arrow-left”, “arrow-right”, “arrow-up”, “delete”, “end”,
“esc”, “f1”, “f2”, “f3”, “f4”, “f5”, “f6”, “f7”, “f8”, “f9”, “f10”, “f11”,
“f12”, “f13”, “f14”, “f15”, “f16”, “fwd-delete”, “help”, “home”, “mute”,
“page-down”, “page-up”, “return”, “space”, “tab”, “volume-down”, “volume-up”
Example: “kp:return” will hit the return key.
Robert Poland - Fort Collins, CO
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden