Auto Login to server using OS 9.x
Auto Login to server using OS 9.x
- Subject: Auto Login to server using OS 9.x
- From: Klaus Friedwagner <email@hidden>
- Date: Mon, 07 May 2001 08:17:42 +0200
>
I am trying to automatically log into a server during startup, but with
>
keychain access in OS 9.1 this is nearly impossible without using guest access
>
to my server, something i don't want to do. Apple says this is possible to get
>
around using an applescript that fills in the username and password and presses
>
"OK". Does anyone have suggestions on how i would do this?
>
i was thinking of putting an alias to the server in my startup folder and
>
then have a script run to fill in the password and then click "ok."
>
or should the script itself find the server?
>
thanks for the help
>
Paul Fisher
>
Applications & Web Development
>
Hudsonville Public Schools
Sorry for my first posting.
Here is teh Script:
To use it, simple place it in any Folder at your disk.
Place a alias to it into the startup-folder.
Drop some volumes or folders on it.
Dont forget: Each volume must be addet to your keychain.
Close your keychain and start the script.
The script will ask you for your password only once.
property _KeychainPassword : ""
property _KeychainName : ""
on run
try
tell application "Schl|sselbund Scripting"
-- activate -- for user to unlock
if _KeychainName name of the current keychain then
set _KeychainName to ""
set _KeychainPassword to ""
end if
if _KeychainName is "" then
set _KeychainName to the name of the current keychain
end if
if locked of keychain _KeychainName is true then
if _KeychainPassword is "" then
display dialog ,
"Geben Sie das Schl|_elbundpasswort f|r " & ,
_KeychainName & " ein:" default answer ""
set _KeychainPassword to text returned of the result
end if
unlock keychain _KeychainName with password ,
_KeychainPassword
end if
end tell
on error msg number num
display dialog msg
end try
log "keychain unlocked"
set this_filepath to path to me as text
set x to the offset of ":" in ,
(the reverse of every character of this_filepath) as string
set the parent_folder_path to ,
(characters 1 thru -(x) of this_filepath) as text
tell application "Finder"
set the alias_list to (every alias file of folder ,
parent_folder_path whose file type is in {"faet", "fdrp"}) as list
repeat with this_alias in the alias_list
try
open this_alias
on error the_error_message number the_error_number
log the_error_number & ", " & the_error_message
end try
end repeat
set the alias_list to (every alias file of ,
folder parent_folder_path whose file type is "srvr") as list
repeat with this_alias in the alias_list
try
get original item of this_alias
on error the_error_message number the_error_number
log the_error_number & ", " & the_error_message
open this_alias
close original item of this_alias
end try
end repeat
end tell
end run
on open theItems -- the Finder always provides us with a list, even for a
single item
set this_filepath to path to me as text
set x to the offset of ":" ,
in (the reverse of every character of this_filepath) as string
set the parent_folder_path to ,
(characters 1 thru -(x) of this_filepath) as text
repeat with anItem in theItems
tell application "Finder"
if file type of anItem is in {"fold", "disk"} then
make new alias file to item anItem ,
at folder parent_folder_path
end if
end tell
end repeat
end open
Friedwagner Klaus
Ooe Nachrichten
Medienaus J. Wimmer
4010 Linz
Austria