|
|
#21 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,016
|
When you log out or shutdown, the system tells each running application to quit, so you could just add an Applescript to your login items that does nothing. But when told to quit, ejects all disks.
Chris |
|
|
|
|
|
#22 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
ha! chris, that is a real clever idea. must refrain from doing too much at that point, perhaps, since shutdown is imminent and services are going bye-bye? hmm...
|
|
|
|
|
|
#23 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,016
|
OK. I searched the Developer docs and figured out how to run a script at logout. If you have installed the Developer tools, the instructions will open if you click this link: file:///Developer/Documentation/Esse...rocedures.html
It works like this--You have a file at /etc/ttys which contains among other things, this line: Code:
console "/System/Library/CoreServices/ loginwindow.app/Contents/MacOS/loginwindow" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/ getty std.9600" This line tells the init program to launch loginwindow on the console terminal and to use WindowServer (which is a symbolic link to the Window Manager process) as the windowing-system process. Into this line, you can insert additional parameters for loginwindow to process. Two useful parameters are -LoginHook and -LogoutHook. These particularly are permit custom administrative, accounting, or security programs to run as part of the login and logout procedures. All you have to do is insert the parameter and the full path to the script you want to run, like this: Code:
console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/ loginwindow -LoginHook /Users/Username/Scripts/ejectDisksOnLogout" vt100 on secure window=/System/Library/CoreServices/WindowServer onoption="/usr/libexec/getty std.9600" I assume the script probably cannot be an Applescript, but must be something that you could run from the Terminal. Chris Last edited by chabig; 02-06-2003 at 01:20 PM. |
|
|
|
|
|
#24 | |||||||||||||||||||
|
Hall of Famer
Join Date: Mar 2002
Posts: 3,878
|
I think you are on to something there. Your code would then look something like this: on quit tell application "Finder" eject the disks end tell end quit I think this would work well. As far as Merv's objections go, I think logging out is pretty polite to running apps, giving them time to save things or do whatever they need to do. I guess you'd have to try it and see what happens. The next enhancement I can think of is to make it faceless so it doesn't show up in the dock. |
|||||||||||||||||||
|
|
|
|
|
#25 | |||||||||||||||||||
|
Hall of Famer
Join Date: Jan 2002
Posts: 3,016
|
Exactly! Now about hiding the dock icon...I saw this here at MacOSXHints: http://www.macosxhints.com/article.p...10701191518268 Chris Last edited by chabig; 02-06-2003 at 05:31 PM. |
|||||||||||||||||||
|
|
|
|
|
#26 |
|
Prospect
Join Date: Jun 2002
Posts: 20
|
To me it would seem more elegant to use the -Logout Hook mentioned above. Could I get a shell script to run this Applescript on Shutdown, rather than have it running all the time?
|
|
|
|
|
|
#27 |
|
Triple-A Player
Join Date: Jan 2002
Location: Cologne, Germany
Posts: 99
|
How about
osascript -e 'tell application "Finder" to eject the disks' HTH, -sapporo. |
|
|
|
![]() |
|
|