Just new to this forum, this is one of the first scripts I made so I could easily macro my computer.
Basically run it and then it copies what you want to do to the clipboard.
Open another apple script editor and paste it.
This script is not optimized because I made it a long time ago.
If you are using this mainly for the browser I recommend learning javascript and just using javascript injection, it is much more reliable and you are able to use your computer while doing it.
set thePath to POSIX path of (((path to desktop) as text) & "cliclick")
--Put this line in a new script on top
set qChar to ASCII character 34
--sets qChar to "
choose from list {"Typing", "Mouse Click", "Keys", "Delay"} with prompt "What would you like to macro"
set whatDoing to result as text
if whatDoing = "Typing" then
display dialog "What would you like to type?" default answer ""
set typeText to text returned of result
set the clipboard to "-- Start of " & typeText & " code" & "
" & "tell application " & qChar & "System Events" & qChar & "
" & "keystroke " & qChar & typeText & qChar & "
end tell" & "
-- End of " & typeText & " code"
else if whatDoing = "Mouse Click" then
choose from list {"Left Click", "Double Click", "Control Click"} with prompt "What click would you like to perform?"
set whatClick to result as text
if whatClick = "Left Click" then
set theClick to ""
else if whatClick = "Double Click" then
set theClick to "d"
else if whatClick = "Control Click" then
set theClick to "c"
end if
display dialog "Put your mouse where you want to click and hit enter"
set AppleScript's text item delimiters to ","
do shell script (quoted form of thePath) & " -q550 440m"
set co_result to result
set x_co to text item 1 of co_result
set y_co to text item 2 of co_result
set the clipboard to "-- Start of " & whatClick & " code" & "
" & "set thePath to POSIX path of (((path to desktop) as text)" & "&" & qChar & "cliclick" & qChar & ")" & "
" & "do shell script (quoted form of thePath) & " & qChar & " " & theClick & x_co & " " & y_co & "m" & qChar & "
-- End of " & whatClick & " code"
else if whatDoing = "Keys" then
choose from list {"Left Arrow", "Right Arrow", "Up Arrow", "Down Arrow", "Enter", "Delete"} with prompt "What key would you like to be performed"
set whatKey to result as text
if whatKey = "Left Arrow" then
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "key code 123" & "
" & "end tell" & "
-- End of " & whatKey & " code"
else if whatKey = "Right Arrow" then
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "key code 124" & "
" & "end tell" & "
-- End of " & whatKey & " code"
else if whatKey = "Up Arrow" then
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "key code 126" & "
" & "end tell" & "
-- End of " & whatKey & " code"
else if whatKey = "Down Arrow" then
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "key code 125" & "
" & "end tell" & "
-- End of " & whatKey & " code"
else if whatKey = "Enter" then
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "keystroke return" & "
" & "end tell" & "
-- End of " & whatKey & " code"
else if whatKey = "Delete" then
delay 2
set the clipboard to "-- Start of " & whatKey & " code" & "
" & "tell application" & qChar & "System Events" & qChar & "
" & "key code 51" & "
" & "end tell" & "
-- End of " & whatKey & " code"
end if
else if whatDoing = "Delay" then
display dialog "How many seconds do you want to delay?" default answer ""
set muchDelay to text returned of result
set the clipboard to "-- Start of " & muchDelay & " second delay code" & "
delay " & muchDelay & "
-- End of " & muchDelay & " second delay code"
end if