`iterm2.Reference("selection?"), iterm2.Reference("selectionLength?")` be always return 'None'
script: #!/usr/bin/env python3.7
import iterm2
async def main(connection): @iterm2.RPC async def smartCopyAndPaste(selectText = iterm2.Reference("selection?"), length = iterm2.Reference("selectionLength?")): print(selectText) print(length) return selectText
# Remember to call async_register!
await smartCopyAndPaste.async_register(connection)
iterm2.run_forever(main)
issue: bind the function to shortcut "ctrl+option+x"
Script always print 'None' whether text in terminal is selected or note. Other Variables like 'autoname' 'name' 'jobPid' is work well.