• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
LogoutHook not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LogoutHook not working


  • Subject: LogoutHook not working
  • From: <email@hidden>
  • Date: Sun, 4 Mar 2007 13:44:40 +0100
  • Thread-topic: 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:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: LogoutHook not working
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Print to PDF
  • Next by Date: Re: Print to PDF
  • Previous by thread: Re: Print to PDF
  • Next by thread: Re: LogoutHook not working
  • Index(es):
    • Date
    • Thread