{"action":"created","issue":{"url":"https://api.github.com/repos/rstudio/rstudio/issues/527","labels_url":"https://api.github.com/repos/rstudio/rstudio/issues/527/labels{/name}","comments_url":"https://api.github.com/repos/rstudio/rstudio/issues/527/comments","events_url":"https://api.github.com/repos/rstudio/rstudio/issues/527/events","html_url":"https://github.com/rstudio/rstudio/pull/527","id":116852307,"number":527,"title":"add applescript support","user":{"login":"randy3k","id":1690993,"avatar_url":"https://avatars.githubusercontent.com/u/1690993?v=3","gravatar_id":"","url":"https://api.github.com/users/randy3k","html_url":"https://github.com/randy3k","followers_url":"https://api.github.com/users/randy3k/followers","following_url":"https://api.github.com/users/randy3k/following{/other_user}","gists_url":"https://api.github.com/users/randy3k/gists{/gist_id}","starred_url":"https://api.github.com/users/randy3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randy3k/subscriptions","organizations_url":"https://api.github.com/users/randy3k/orgs","repos_url":"https://api.github.com/users/randy3k/repos","events_url":"https://api.github.com/users/randy3k/events{/privacy}","received_events_url":"https://api.github.com/users/randy3k/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-13T21:07:40Z","updated_at":"2015-11-13T21:55:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rstudio/rstudio/pulls/527","html_url":"https://github.com/rstudio/rstudio/pull/527","diff_url":"https://github.com/rstudio/rstudio/pull/527.diff","patch_url":"https://github.com/rstudio/rstudio/pull/527.patch"},"body":"It is a hack to implement applescript support. Basically it uses `MainFrameController evaluateJavaScript` to run a piece of javascript which paste and run the R code at the console.\r\n\r\nThe implementation may be hacky, but it works.\r\n \r\n![untitled](https://cloud.githubusercontent.com/assets/1690993/11157636/8e6e1714-8a20-11e5-98bc-d82e0597e384.gif)\r\n\r\n```applescript\r\ntell application \"/Applications/RStudio.app\"\r\n\tdo rscript \"a=1\"\r\n\tdo javascript \"alert('hi')\"\r\nend tell\r\n```"},"comment":{"url":"https://api.github.com/repos/rstudio/rstudio/issues/comments/156570367","html_url":"https://github.com/rstudio/rstudio/pull/527#issuecomment-156570367","issue_url":"https://api.github.com/repos/rstudio/rstudio/issues/527","id":156570367,"user":{"login":"randy3k","id":1690993,"avatar_url":"https://avatars.githubusercontent.com/u/1690993?v=3","gravatar_id":"","url":"https://api.github.com/users/randy3k","html_url":"https://github.com/randy3k","followers_url":"https://api.github.com/users/randy3k/followers","following_url":"https://api.github.com/users/randy3k/following{/other_user}","gists_url":"https://api.github.com/users/randy3k/gists{/gist_id}","starred_url":"https://api.github.com/users/randy3k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randy3k/subscriptions","organizations_url":"https://api.github.com/users/randy3k/orgs","repos_url":"https://api.github.com/users/randy3k/repos","events_url":"https://api.github.com/users/randy3k/events{/privacy}","received_events_url":"https://api.github.com/users/randy3k/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T21:55:28Z","updated_at":"2015-11-13T21:55:28Z","body":"1. No, we don't need to expose `do javascript`, it just made my life easier when I was testing the code. I could remove the `do javascript` bit.\r\n\r\n2. Since I have several \"RStudio.app\" in different directories and applescript doesn't pick up the correct application from time to time, so I instead provide the full path. `tell application \"RStudio\" ` will work for most users.\r\n\r\n3. I am afraid that it doesn't. Unless, there is a way for the instances to communicate.\r\n\r\nPS: sent you the agreement."}}