nathancahill / Anycomplete

The magic of Google Autocomplete while you're typing. Anywhere.
1.54k stars 49 forks source link

not pasting results into any apps #7

Closed EvanZ closed 7 years ago

EvanZ commented 7 years ago

I followed installation instructions and get to the point where I can type and get autocomplete results, but when I select one it doesn't get pasted into the text editor (or terminal) I'm using. Here is the log from Hammerspoon console:

Welcome to the Hammerspoon Console!
You can run any Lua code in here.

-- Lazy extension loading enabled
-- Loading extension: notify
-- Loading extension: fnutils
-- Can't find ~/.hammerspoon/init.lua; create it and reload your config.
-- Lazy extension loading enabled
-- Loading extension: notify
-- Loading extension: fnutils
-- Can't find ~/.hammerspoon/init.lua; create it and reload your config.
-- Lazy extension loading enabled
-- Loading ~/.hammerspoon/init.lua
-- Loading extension: hotkey
16:21:59     hotkey: Enabled hotkey ⌘⌃⌥G
-- Done.
-- Loading extension: application
-- Loading extension: uielement
-- Loading extension: chooser
-- Loading extension: http
-- Loading extension: json
-- Loading extension: eventtap
-- Loading extension: fnutils
-- Lazy extension loading enabled
-- Loading ~/.hammerspoon/init.lua
-- Loading extension: hotkey
16:26:07     hotkey: Enabled hotkey ⌘⌃⌥G
-- Done.
-- Loading extension: application
-- Loading extension: uielement
-- Loading extension: chooser
-- Loading extension: http
-- Loading extension: json
-- Loading extension: fnutils
-- Loading extension: eventtap
-- Lazy extension loading enabled
-- Loading ~/.hammerspoon/init.lua
-- Loading extension: hotkey
16:29:50     hotkey: Enabled hotkey ⌘⌃⌥G
-- Done.
-- Loading extension: application
-- Loading extension: uielement
-- Loading extension: chooser
-- Loading extension: http
-- Loading extension: json
-- Loading extension: fnutils
-- Loading extension: eventtap
nathancahill commented 7 years ago

To isolate, can you try in TextEdit? Add a debug line right after local current = with print(current). That should output something like hs.application: TextEdit (0x61000065e808). You could also try adding print(choosen.text) right before hs.eventtap.keyStrokes to make sure it's sending the right keystrokes.

nathancahill commented 7 years ago

Oh, and make sure to enable Hammerspoon in Accessibility.

EvanZ commented 7 years ago

I tried looking up these two NBA players (I'm a Warriors lol!).

hs.application: TextWrangler (0x7fc12ae81588)
-- Loading extension: fnutils
draymond green
-- Loading extension: eventtap
hs.application: TextWrangler (0x7fc12ae24c38)
draymond green
hs.application: TextWrangler (0x7fc12f990128)
stephen curry
nathancahill commented 7 years ago

Hmm. Well it's obviously doing something. Hard to say why it's failing to output.

EvanZ commented 7 years ago

Ok, now it seems to be working with TextEdit and the Terminal app. Just not TextWrangler for some reason. Oh, well. Thanks!

nathancahill commented 7 years ago

Dunno if TextWrangler does something special with keystrokes. It should be indistinguishable from the keyboard :shrugs: