Re: -Logouthook
Re: -Logouthook
- Subject: Re: -Logouthook
- From: "John C. Welch" <email@hidden>
- Date: Sun, 02 Mar 2003 20:14:58 -0500
On 03/01/2003 16:12, "John C. Welch" <email@hidden> wrote:
It's making me even MORE nuts
>
>
My TTYS file line looks like:
>
>
console
>
"/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow
>
-LogoutHook /Library/Scripts/killuserfonts.sh" vt100 on secure
>
window=/System/Library/CoreServices/WindowServer onoption="/u
>
sr/libexec/getty std.9600"
>
>
The killuserfonts.sh script is:
>
#!/bin/sh
>
>
#script that attaches to osascript to delete user fonts
>
>
/usr/bin/osascript /Library/Scripts/killUserFonts.scpt
>
>
And killUserFonts.scpt looks like
Two versions, both fail miserably:
Simple version
property theUser : ""
property killFontCommand : ""
property killTheFonts : "/bin/rm -r "
set theUser to do shell script "/usr/bin/whoami"
set theUserFontFolder to "/Users/" & theUser & "/Library/Fonts/"
set killFontCommand to killTheFonts & theUserFontFolder & "*"
do shell script killFontCommand
Doesn't work at all.
The Complex version:
property theCurrentUserFonts : ""
property posixFontPath : ""
property killTheFonts : "/bin/rm -r "
property testKill : "/bin/rm -r /Users/jwelch/test/oldfonts/*"
property killFontCommand : ""
property theUsersFolder : ""
property theUsersFolderText : ""
property theUsersFolderPosixPath : ""
property theFolderContents : {}
property theUserFolders : {}
property theTestFolder : ""
property theTestFolderName : ""
property theTestFolderPosixPath : ""
property theResults : ""
property theUser : ""
set theUsersFolder to path to users folder -- get the path as alias
set theUsersFolderText to theUsersFolder as text --get a text version of
this
set theUsersFolderPosixPath to POSIX path of theUsersFolder -- get posix
version of the path
set theResults to do shell script "ls /Users/" --get the general listing of
the Users folders
set oldDelims to AppleScript's text item delimiters --save the text
delimiters
set AppleScript's text item delimiters to "
" --set the delimiters to the return character
set theFolderContents to (every text item of theResults) --make a list
set AppleScript's text item delimiters to oldDelims --restore the old delims
set testCount to (length of theFolderContents) as text
repeat with x from 1 to (length of theFolderContents) --iterate the list
set theTestFolder to item x of theFolderContents --grab an item
if theTestFolder is not "Shared" then --we don't want that folder
set theTest to theUsersFolderText & theTestFolder as alias --make an
alias
set theTestInfo to info for theTest --get the info for that item
if (folder of theTestInfo) then --it's a folder, and not shared
set thetheTestFolderPosixPath to theUsersFolderPosixPath &
theTestFolder & "/Library/Fonts/" --build the path to the users font folder
set the end of theUserFolders to thetheTestFolderPosixPath --add
this to the list
end if
end if
end repeat
repeat with x from 1 to (length of theUserFolders) -- iterate this list
set posixFontPath to item x of theUserFolders -- grab the first font
folder path
set killFontCommand to killTheFonts & posixFontPath & "*" --build the rm
command for the font path
do shell script killFontCommand -- blow out the directory contents
end repeat
All I want to do is wipe the ~/Library/Fonts on logout...AUUUUUGH.
john
--
"March or Die"
- French Foreign Legion
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.