I'm writing an app to massage some data and then burn it to a disc by having LC launch an Automator app that brings up a window asking the user to select the files and, once the user does this, burns the file(s) to a CD/DVD. Everything works except that when I call the Automator app, the 'choose the files' window remains behind the LC app's window. I have to switch to it by clicking or Command-Tabbing.
The solution I found was this:
Code: Select all
on mouseUp launch "/Users/blevine/Desktop/Burn disc of Files.app" -- App remains in background so I need to do something more! do field "doThis" as AppleScript -- field "doThis" contains >> tell application "Burn disc of files.app" to activate -- above line of code properly switches focus to the correct app end mouseUp
The next step is to pass the name(s) of the appropriate files directly to the Automator app so all the user has to do is put in the appropriately sized disc (CD or DVD).
I know there's some terminal code that can accomplish this (hdiutil I think >> EDIT: drutil, not hdiutil) but that may be for the next version. But that also brings up another question: Is there common code to do this within LC or will I have to check the platform and use one of two different scripts depending of whether my app is running on macOS or Windows?