I've managed to leverage the mouse gestures plugin to do useful things in
Safari with the following script and actions. Please note that the script
relies upon HammerSpoon for the UI Interactions, but it's pretty speedy.
*My question -- the plugin doesn't allow me to use Mouse_2 as a trigger.
If I go in there and brute force the .plist or something, does anyone
think that I'll cause havok with my system? I'd rather use my right mouse
button for Abracadabara triggers instead of my mouse scroll wheel.*
Later on, I might attempt to recompile the Abracadabara plugin from
scratch, but as I understand it, recompiling QS plugins are more than a 15
minute task.
For anyone interested in the script that I use with Abracadabara, here it
is below.
I bind my "draw a line from left to right" gesture to move me one tab to
the right (which I've got mapped to "{ctrl cmd shift alt} D") and visa
versa. Requires HammerSpoon and the CLI for HammerSpoon.
--
-- Input in text is:
-- App Key <mods> [; App Key <mods> ...]
--
-- App is something like "Safari", "Finder", etc.
-- Key is either unicode number or keyname used in Hammerspoon
-- Mods are one or more of cmd,shift,ctrl,alt,fn
--
-- Example: Safari d cntrl alt shift cmd; Safari d cntrl alt shift cmd
--
-- Separate multiple keys with a semicolon.
--
*using terms from* *application* "Quicksilver"
*on* *process text* myIn
-- set oldDelim to AppleScript's text item delimiter
*set* AppleScript's text item delimiters *to* ";"
*set* myCmds *to* myIn's *text items*
*set* AppleScript's text item delimiters *to* ""
# App, letter, mods
--mods = "shift, cmd, alt, cntrl" or any combination
-- display notification "-------------------------------
At top, text is <" & myIn & ">"
*set* tlen *to* length *of* myCmds
-- display notification "TLEN is " & tlen
*repeat* *with* i *in* myCmds
*try*
*set* newi *to* trim(*true*, i)
*set* i *to* newi
-- display notification "i is <" & i & ">"
*set* AppleScript's text item delimiters
*to* " "
*set* comps *to* i's *text items*
*set* tlen *to* length *of* comps
-- display notification "Tlen for comps is "
& tlen
*set* myApp *to* *first* *item* *of* comps
-- display notification "My app is <" &
myApp & ">"
*set* myKey *to* *second* *item* *of* comps
-- display notification "My myKey is <" &
myKey & ">"
*if* (*count* *of* comps) > 2 *then*
*set* myMods *to* *items* 3 *thru* (
length *of* comps) *of* comps
*else*
*set* myMods *to* ""
*end* *if*
-- display notification "My myMods is <" &
myMods & ">"
*on* *error*
*display notification* "Usage:
sendkeys.scpt app key [mods]"
*return*
*end* *try*
*set* indCmd *to* "/Users/petonic/bin/hs -c "
*set* indCmd *to* indCmd &
"'hs.appfinder.appFromName(\"" & myApp & "\" ):activate();"
*set* indCmd *to* indCmd &
"hs.eventtap.keyStroke({\"" & myMods & "\"}, \"" & myKey & "\");'"
-- display notification "indCmd is <" & indCmd & ">"
*try*
*set* ssres *to* *do shell script* indCmd
*on* *error* errStr number errorNumber
*display dialog* "Got an error in the
shellscript <" & errStr & ">, number = " & ¬
*number* & " errorNumber = " &
errorNumber & " Result = <" & ¬
ssres & ">"
*return*
*end* *try*
*if* ssres *is* *not* "" *then*
*display dialog* ¬
"Got an error in the shellscript
Result = <" & ssres & ">"
*end* *if*
-- display notification "Result is <" & ssres & ">"
*end* *repeat*
*end* *process text*
*end* *using terms from*
*on* trim(theseCharacters, someText)
--display notification "Calling trim with <" & theseCharacters & ">"
-- display notification "... on <" & someText & ">"
-- Lazy default (AppleScript doesn't support default values)
*if* theseCharacters *is* *true* *then* *set* theseCharacters *to* ¬
{" ", tab, *ASCII character* 10, return, *ASCII character*
0}
*repeat* *until* *first* *character* *of* someText *is not* *in*
theseCharacters
*set* someText *to* *text* 2 *thru* -1 *of* someText
*end* *repeat*
*repeat* *until* *last* *character* *of* someText *is not* *in*
theseCharacters
*set* someText *to* *text* 1 *thru* -2 *of* someText
*end* *repeat*
*return* someText
*end* trim
--
You received this message because you are subscribed to the Google Groups
"Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/blacktree-quicksilver.
For more options, visit https://groups.google.com/d/optout.