I’ve found the application Backdrop to be very useful in reducing clutter and helping me focus on the task at hand, especially when that task involves editing of some sort. So I wanted to write a script that would sort of slide Backdrop under the window I was working in.
I’ve tried two approaches:
First, getting the name of the current app, then activating BD, then activating the app I want to work in. E.g.
set curapp to ""
tell application "System Events"
set curapp to item 1 of (get name of processes whose frontmost is true)
end tell
tell application "Backdrop"
activate
end tell
tell application curapp
activate
set visible of windows to true
end tell
That doesn’t work; I’m left with the plan Backdrop window.
I’ve also tried to use System Events to mimic the command-tab keystroke:
tell application "Backdrop" to activate
tell application "System Events"
keystroke tab using (command down)
end tell
I want it to launch Backdrop, then switch to whatever app I was working in when I launched the script. That second part is what neither script is doing.
tell application "System Events"
set t to name of every process whose frontmost is true
set t to t as string
end tell
tell application "Backdrop" to launch
tell application "System Events"
tell application t to activate
end tell
That doesn’t seem to do anything, probably because Backdrop is already running. And when I replace “tell application “Backdrop” to launch” with ‘tell application “Backdrop” to activate’, I get the same behavior as before, e.g. Backdrop launches and the script doesn’t complete.
What seems to be happening is that Backdrop is somehow keeping the script from running the lines that follow its activation.