I’ve been working on a login script that pops up dialog boxes for users to login running Dave in the background, and then mounts their networked shares based upon their username. So far its worked pretty well, but I’ve run into a couple of roadblocks that I just can’t seem to get past. I’m new to AppleScripting so I might just be completely missing something, but I’ve looked hard to try to find it.
My first problem is the application timeout on the script. I need the script to be constantly running because it will be a lab computer and we don’t want people to be able to access it without authorization. I’ve been able to use the ‘with timeout of x seconds’ command, and right now it is set to 10 hours, but is there a way to put an infinite time in there? I tried using zero, but that returned an error. Is there a different command or setting I should use?
My second problem is that if it returns an error I want it to start the Script back over again instead of displaying the error. Is there like an “on error activate x” command(s)? Do I need to write down each error and make some sort of listing of them and do a ‘text returned of login’?
And my last question isn’t really a problem so much as it is an annoyance. Is there a way to have two input fields in a dialog box? Right now it spawns a Username box and then a Password box after you put your name in. I tried to work with Cocoa a little bit, but evidently not enough to know how to impliment those things. I designed a sort of interface for what I want the design to look like, but I don’t know how to combine the style of the dialog box with the AppleScripting
Thanks guys and gals
-- Set variables for network login
tell application "Finder"
activate
with timeout of 36000 seconds
set Dialogin to display dialog "Please enter your username" default answer ""
with icon stop buttons {"Ok"} default button "Ok"
set namevar to text returned of Dialogin
set Diapass to display dialog "Please enter your password" default answer ""
with icon stop buttons {"Ok"} default button "Ok"
set passvar to text returned of Diapass
set UserEntry to the text returned of Dialogin
set ButtonReturned to the button returned of Dialogin
end timeout
end tell
-- Use Dave for network login
tell application "DAVE Scripting"
logon username namevar with password passvar in domain "REGENTNT"
quit
end tell
-- Open shared folders
tell application "Finder"
set datum to "smb://datum/home/" & namevar
mount volume datum
mount volume "smb://zero/desktop$"
mount volume "smb://datum/resources"
set acadweb to "smb://acadweb/" & namevar
set acaddata to "smb://acaddata/home/" & namevar
set banshr to "smb://banforms/banshr"
mount volume acadweb
mount volume acaddata
mount volume banshr
end tell