Re: How to determine whether launched automatically at login
Re: How to determine whether launched automatically at login
- Subject: Re: How to determine whether launched automatically at login
- From: kai <email@hidden>
- Date: Sun, 21 Aug 2005 11:34:10 +0100
On 21 Aug 2005, at 01:04, I wrote:
The following suggestion attempts to address some of these issues:
This modified version might help to improve the accuracy of the first
run (and allow a little more flexibility when setting the value of
the 'launchTime' property, should it be needed):
------------------
property prevLogin : missing value
property launchTime : 100 (* max seconds to launch app: adjust as
necessary *)
on launchedAtLogin()
set currLogin to (info for POSIX file (POSIX path of (path to
preferences ¬
from local domain) & "com.apple.loginwindow.plist"))'s
creation date
tell prevLogin to if it is currLogin then
return false
else
set prevLogin to currLogin
if it is missing value and ((my (current date)) - currLogin)
> launchTime then return false
end if
set loginData to read POSIX file (POSIX path of (path to
preferences) & "loginwindow.plist")
considering case
tell POSIX path of (path to me) to if it ends with "/" then
text 2 thru -2 is in loginData
else
text 2 thru -1 is in loginData
end if
end considering
end launchedAtLogin
if launchedAtLogin() then
display dialog "Launched at login."
else
display dialog "Launched manually."
end if
------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden