I have a hard disk w/ 3 partitions, 2 of which I usually want to keep unmounted, so when I start up I open Disk Utility and unmount them. Definitely a task to be automated, no?
If I list Disk Utility as a Login Item, the app activates OK on startup but its window isn’t visible, so I have to type Command-N or select New Window from the File menu. I tried varying the order of my Login Items, but that didn’t solve the no-window problem. Disk Utility is the frontmost app but has no window.
I made a script to open the app (actually 2 apps that I like to have open when I startup), with Disk Utility as the last app to open. Then I listed the script as a Login Item. Same result.
[BTW, this no-window problem only occurs at startup. If I run the script manually, Disk Utility opens normally w/ a nice normal window]
Then I came up w/ a System Events way to open the New Window menu item. That’s great but how can I make it conditional, so it opens a new window only if there isn’t one already open?
Finally, I was hoping eventually to script Disk Utility to unmount those 2 disk partitions I mentioned at the top, but am I correct in understanding that Disk Utility is not scriptable?
Here’s my script; the Disk Utility part is only the last 8 lines. I’m a beginner so pls be gentle.
to |set position| for w to {x, y}
set {l, t, r, b} to w's bounds
set w's bounds to {x, y, x + r - l, y + b - t}
end |set position|
activate application "Internet Connect"
tell application "System Events"
tell process "Internet Connect"
click menu item "Internal Modem" of menu "Window" of menu bar 1
end tell
end tell
|set position| for application "Internet Connect"'s window 1 to {672, 427}
tell application "Disk Utility"
activate
tell application "System Events"
tell process "Disk Utility"
click menu item "New Window" of menu "File" of menu bar 1
end tell
end tell
end tell
Model: PowerBook G4
AppleScript: 1.10.6
Operating System: Mac OS X (10.4)