Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LogoutHook not working



Hi everyone,

I have been struggling with getting a logout hook to run an applescript, but nothing works.

I know almost nothing about shell scripts and I have followed intructions on the internet (developer.apple and macosxhints). This is one version of the script:

#!/bin/bash
#logoutscript

timestamp=`date ''+%Y/%m/%d/%H.%M.%S''`
logfile="/Users/gunno/Documents/Flex/logoutTime.txt"
myApp="/Library/Hooks/logout.app/"

echo $timestamp >> "$logfile"
open "$myApp"
exit 0

I have wrote to defaults and set the execution bit.
Instead of 'open "$myApp"' I have tried various solutions with osacript to no avail. Everything is fine from the terminal, but not when logging out. I have saved my applescript as application, application bundle, script and text.
My applescript:

on run
	set gLogFile to (path to documents folder from user domain as string) & "Flex:FlexLogTest.txt"
	set fileRef to open for access file gLogFile with write permission
	set theText to (current date) as string
	write theText to fileRef starting at ((get eof of fileRef) + 1)
	close access fileRef
	0
end run

The system log shows this error:
(62: coreservicesd)tfp: failed on 0:

What am I doing wrong?

Gunno I
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.