Ok so I know I am going a little over board .. but I took this idea form movingimage from the post found here and modified it to work with as many clicks as you would like.
It will execute a different trigger for each click as you go..
I have a screen setup that has 8 different snap areas and this allows me to rotate my active window through all of them by continuing to push the same button/keystroke. It does have a timeout of one second.. so if you can not click faster than one second per click you can adjust the time.
steps
-
Add the desired triggers to the "Named and other Triggers" section of BTT
-
Set up a Button/Keystroke and assign it to "Run Apple Script (async in background)" and copy the below script in
-
adjust the script for how many clicks you would like in the clickCheck section. I put in ten but I only use eight. you just have to move the line indicated with a
"-- Move me to the amount of clicks you have" -
Rename the trigger events to match the ones you set up on the "Automations & Named & Other Triggers" page in step 1
-
Click the "Complie / Test" button and then select save.
-
Click/Push/Keystroke your key or button that you set up and watch the magic happen.
Note*** if you use this multiple times for other triggers you may want to change the global variables as they would conflict with the other.
--#########################################################################################################
--# Written by doctorquad July 2020
--# This script will do exactly what you tell it to ... The common problem in all errors is YOU
--# Author takes no responsibility to how when or where you use this script... Note the above comment.
--#########################################################################################################
global currentCount
global lastRunTime
global timeDelay
--Set this to the time delay in secconds that you would like
set timeDelay to 1
checkDuration()
--################################
--Check to see if it has been more then 3 secconds
on checkDuration()
try
-- Set the duration based on the global variable that was set last time this ran so we know how long it has been.
set duration to (current date) - lastRunTime
-- If it has been less then the set timeDelay run the clickCheck. if not reset the count and run the clickCheck
if duration ≤ timeDelay then
--Run the clickCheck with the current count of clicks
clickCheck(currentCount)
else
--We missed the timedelay window so reset the count and run the clickCheck
resetCount()
clickCheck(currentCount)
end if
on error
-- If the script has not ran we get an error because the variables are not set.. we need to set the variables then run the clickCheck
set duration to "FirstAttempt"
resetCount()
clickCheck(currentCount)
end try
log "Duration from last click " & duration
end checkDuration
--################################
--################################
-- Update the last time this script was ran
on updateRunTime()
try
set lastRunTime to current date
end try
end updateRunTime
--################################
--################################
-- Reset the count to 0
on resetCount()
try
set currentCount to 0
end try
end resetCount
--################################
--################################
-- Incrament the count or set it to 0 in error
on increment()
try
log "incrementCount " & currentCount & "."
-- Increment the count by one
set currentCount to currentCount + 1
on error
set currentCount to 0
end try
end increment
--################################
--################################
--This is what does all the work depending on how many times you clicked will run through the clicks
on clickCheck(clicks)
try
log "clickCheck " & clicks
if (clicks = 0) then
tell application "BetterTouchTool"
trigger_named "RaiseWindow"
--change this to be your 1st trigger name
trigger_named "MoveMain"
end tell
else if (clicks = 1) then
tell application "BetterTouchTool"
--change this to be your 2nd trigger name
trigger_named "MoveBigMain"
end tell
else if (clicks = 2) then
tell application "BetterTouchTool"
--change this to be your 3rd trigger name
trigger_named "MoveBottomLeft"
end tell
else if (clicks = 3) then
tell application "BetterTouchTool"
--change this to be your 4th trigger name
trigger_named "MoveTopLeft"
end tell
else if (clicks = 4) then
tell application "BetterTouchTool"
--change this to be your 5th trigger name
trigger_named "MoveTopMain"
end tell
else if (clicks = 5) then
tell application "BetterTouchTool"
--change this to be your 6th trigger name
trigger_named "MoveTopRight"
end tell
else if (clicks = 6) then
tell application "BetterTouchTool"
--change this to be your 7th trigger name
trigger_named "MoveBottomRight"
end tell
else if (clicks = 7) then
tell application "BetterTouchTool"
--change this to be your 8th trigger name
trigger_named "MoveMain"
--This is where you set the count back to 1 so that it will keep looping. If you do not have 8 triggers then move these lines to the last one of your set.
set currentCount to 0 -- Move me to the amount of clicks you have
end tell
else if (clicks = 8) then
tell application "BetterTouchTool"
--change this to be your 9th trigger name
trigger_named "tbd"
end tell
else if (clicks = 9) then
tell application "BetterTouchTool"
--change this to be your 10th trigger name
trigger_named "tbd"
end tell
else
tell application "BetterTouchTool"
--change this to be your what trigger you would like the defualt to be.. you will most likly never hit this but you never know.
trigger_named "MoveMain"
end tell
end if
on error
tell application "BetterTouchTool"
--This is just the trigger that you would like to run if for some reason you get an error .. usually when you run the script for the first time as it has not populated the varables yet.
trigger_named "MoveMain"
end tell
end try
--Update the last run variable so that the timeout start over.
updateRunTime()
--incrament the count so the next click will go to the next trigger.
increment()
end clickCheck
--################################