I want to script Emacs, which is unscriptable in OSX, but my understanding is that most unscriptable programs can have some support through "System Events", otherwise known as GUI scripting.
I want to start with raising windows with a particular name. I used the following script successfully.
In this case, Emacs had two frames, and this typed "foo" into the first frame. So that's good. But what I really want to do is raise a particular Emacs window, determined by its name. I tried the following:
This gave an error "Can't get window 1 of process Emacs, invalid index". So I am confused appartenly it works to "tell" window 1 something, but trying to "get" something returns the result that it doesn't exist?
Ultimately what I want to do is raise a particular window. Can anyone help?
Note that I am trying to avoid paid macro programming software, as I just don't see a need for it. I am a programmer, and this stuff should be doable with AppleScript and Automator.
I want to start with raising windows with a particular name. I used the following script successfully.
tell tell application "Emacs"
activate
end tell
tell application "System Events"
tell application process "Emacs"
tell window 1
keystroke "foo"
end tell
end tell
end tell
In this case, Emacs had two frames, and this typed "foo" into the first frame. So that's good. But what I really want to do is raise a particular Emacs window, determined by its name. I tried the following:
tell application "Emacs"
activate
end tell
tell application "System Events"
tell application process "Emacs"
get name of window 1
end tell
end tell
This gave an error "Can't get window 1 of process Emacs, invalid index". So I am confused appartenly it works to "tell" window 1 something, but trying to "get" something returns the result that it doesn't exist?
Ultimately what I want to do is raise a particular window. Can anyone help?
Note that I am trying to avoid paid macro programming software, as I just don't see a need for it. I am a programmer, and this stuff should be doable with AppleScript and Automator.