tell application "System Events"
set theF24Down to
false
set theF23Down to
false
set
startMouseCoordinate to {}
on key down theKey
if theKey is
"F24" then
set
theF24Down to true
set startMouseCoordinate
to get mouse location
set
xCoordinate to (startMouseCoordinate's x)
set
yCoordinate to (startMouseCoordinate's y)
set
endTime to (current date) + (350 * milliseconds)
mouse down
at {xCoordinate, yCoordinate}
repeat
set
mouseCoordinate to get mouse location
if
mouseCoordinate is not {xCoordinate, yCoordinate} then
set endTime to (current date) + (350 * milliseconds)
set xCoordinate to (mouseCoordinate's
x)
set yCoordinate to (mouseCoordinate's y)
end if
if
(current date) > endTime then
exit repeat
end if
end repeat
mouse up
at {xCoordinate, yCoordinate}
mouse move
{xCoordinate, yCoordinate + 10}
set mouse
position to startMouseCoordinate
else if theKey
is "F23" then
set
theF23Down to true
set
startMouseCoordinate to get mouse location
set
xCoordinate to (startMouseCoordinate's x)
set
yCoordinate to (startMouseCoordinate's y)
set
endTime to (current date) + (350 * milliseconds)
mouse down
at {xCoordinate, yCoordinate}
repeat
set
mouseCoordinate to get mouse location
if
mouseCoordinate is not {xCoordinate, yCoordinate} then
set endTime to (current date) + (350 * milliseconds)
set xCoordinate to (mouseCoordinate's x)
set yCoordinate to (mouseCoordinate's y)
end if
if
(current date) > endTime then
exit repeat
end if
end repeat
mouse up
at {xCoordinate, yCoordinate}
mouse move
{xCoordinate, yCoordinate - 10}
set mouse
position to startMouseCoordinate
end if
end key down
end tell
Hello I wanted to remap an F23/F24 keys to do an action when I press them. All I want is similar to a Click and Drag function.