Creating a quick event in iCal using LaunchBar & AppleScript
-
30-10-2019 - |
Question
what i want to figure out is how to send a String to iCal 5 on 10.7 which is interpreted the same way as creating a quick event, as if you press CMD+N with iCal in focus and then just type "tea at 5" into the popover.
a simplistic sketch (which doesn't work):
on handle_string(theString)
tell application "iCal"
make new event with theString
end tell
end handle_string
i'm comfortable with programming but never done anything with AppleScript. Is there a reference for application commands?
edit:
this works and it's not even slow, the only caveat is that it breaks the clipboard:
on handle_string(theString)
tell application "LaunchBar"
perform action "Copy" with string theString
end tell
tell application "iCal" to activate
tell application "System Events"
keystroke "n" using {command down}
keystroke "v" using {command down}
keystroke return
end tell
end handle_string
it's sort of finicky to use the clipboard in a script? i can't figure out how to temporarily hold the clipboard content in a variable, and then set the clipboard back to it. i'll accept your answer if you help me with that.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange