

def _dispatch_safari_rstudio(self, cmd):
    cmd = self.clean_cmd(cmd)
    cmd = self.escape_dquote(cmd)
    cmd = script.replace('\n', '\\n')
    script = '\n        on run argv\n            tell application "Safari"\n                tell front window\'s current tab to do JavaScript "\n                    var input = document.getElementById(\'rstudio_console_input\');\n                    var textarea = input.getElementsByTagName(\'textarea\')[0];\n                    textarea.value += \\"" & item 1 of argv & "\\";\n                    var e = document.createEvent(\'KeyboardEvent\');\n                    e.initKeyboardEvent(\'input\');\n                    textarea.dispatchEvent(e);\n                    var e = document.createEvent(\'KeyboardEvent\');\n                    e.initKeyboardEvent(\'keydown\');\n                    Object.defineProperty(e, \'keyCode\', {\'value\' : 13});\n                    input.dispatchEvent(e);\n                "\n            end tell\n        end run\n        '
    subprocess.call(['osascript', '-e', script, cmd])

dataset/ETHPy150Open randy3k/SendTextPlus/textsender.py TextSender._dispatch_safari_rstudio/VarMisuse@32/44 `cmd`->`script`