I have a function where I pass in the name of an application. Within the function, one of the things I'd like to do is restore the windows of the application:
on test(applicationName)
-- do some work
-- restore all windows
-- do some more work
end test
I've found references on how to restore the windows of an application by setting the miniaturized property, ala:
tell application "Maps"
set miniaturized of windows to false
end tell
(see Un-minimizing an app with Applescript)
But this requires one to specify the name of the app at compile time - I have to hard code the name of the app into the code - I can't use "tell application applicationName" even though applicationName is a string:
on test(applicationName)
-- do some work
-- restore all windows
tell application applicationName
set miniaturized of windows to false
end tell
--- do some more work
end test
(see tell application - string vs. string?)
Is it possible to restore the windows of an application, when I reference the name of the application as a variable?
There must be another way to do this, but the only examples I've found to do this is the "tell application/set miniaturized of windows" approach.