• 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
Re: Keychain Scripting for Program Linking doesn't work! (sometimes}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keychain Scripting for Program Linking doesn't work! (sometimes}


  • Subject: Re: Keychain Scripting for Program Linking doesn't work! (sometimes}
  • From: JollyRoger <email@hidden>
  • Date: Sun, 17 Mar 2002 13:07:29 -0600

On 3/17/2002 12:28 PM, "Sander Tekelenburg" <email@hidden> wrote:

> try
> tell application "Keychain Scripting"
> unlock keychain "Link" with password "blabla"
> quit
> end tell
> on error m number n
> display dialog n & return & return & (m as text)
> end
>
> In this case, since you only run into an error when your script runs
> unattended, I would have it write the error to a file, instead of to a
> dialog.

I use this for logging on my headless gateway:

-- begin script
property pLogRef : 0
property pLogFolder : (path to (startup disk) as text) & "Desktop Folder:"
property pLogFileName : "My Log File"

my LogEntry("this is a log entry")

on LogEntry(someText)
set logFile to (pLogFolder as text) & pLogFileName
if pLogRef = 0 then set pLogRef to open for access (file logFile) with
write permission
if pLogRef  0 then
write FormatDateTime(current date) & ": " & someText & return
starting at eof to pLogRef
close access pLogRef
set pLogRef to 0
end if
end LogEntry

on FormatDateTime(theDate)
set theDate to theDate as date
set dd to text -2 thru -1 of ("0" & theDate's day)
copy theDate to tempDate
set the month of tempDate to January
set mm to text -2 thru -1 of ,
("0" & 1 + (theDate - tempDate + 1314864) div 2629728)
set yy to text -1 thru -4 of ((year of theDate) as text)
set hh to time string of theDate
return (yy & mm & dd & " @ " & hh as text)
end FormatDateTime
-- end script

HTH

JR
_______________________________________________
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.

References: 
 >Re: Keychain Scripting for Program Linking doesn't work! (sometimes} (From: Sander Tekelenburg <email@hidden>)

  • Prev by Date: Re: The Ones & Oh's of Logic
  • Next by Date: Re: Getting a PID and killing a process
  • Previous by thread: Re: Keychain Scripting for Program Linking doesn't work! (sometimes}
  • Next by thread: Re: Keychain Scripting for Program Linking doesn't work! (sometimes}
  • Index(es):
    • Date
    • Thread