relating to this post, https://apple.stackexchange.com/questions/70585/applescript-opens-new-window-for-everything-when-run.
I wonder if i can highlight the selected text and run this service, can i have the selected text in the new tweet textbox?
Here’s the current codes:
activate application "Tweetbot"
tell application "System Events"
tell process "Tweetbot"
repeat until exists
delay 0.4
end repeat
set frontmost to true
delay 0.2
keystroke "n" using command down
end tell
end tell
You can pass the selected text as a variable in Automator and use UI scripting to set the contents of the text field.
If you run the script with a shortcut that has other modifier keys than command, try replacing
keystroke "n" using command downwithclick menu item "New Tweet" of menu 1 of menu bar item "Tweet" of menu bar 1.