-- /! GET THE PATH OF THIS SCRIPT !\--

set myPath to path to me as text

--display dialog myPath


-- /! CREATE THE FULL PATH OF THE PREFERENCE FILE !\--

set PrefPath to myPath & "user.txt"

--display dialog PrefPath


-- /! CHECK IF THE PREFERENCE FILE IS HERE !\--

set msg to "no"

tell application "Finder"
    if exists PrefPath then

set msg to "yes"
    else

      display dialog "What is your username at brunel ? (This is the same as your mailbox)" default answer ""                 buttons {"OK"} default button 1

set username to text returned of result

      tell application "TextEdit"

        activate

make new document

        

set text of front document to username as text

        

save front document in PrefPath

quit saving no

      

end tell

    

end if

end tell

--display dialog msg


-- /! READ THE USERNAME !\--

set the_file to PrefPath as alias

open for access the_file

set username to read the_file

close access the_file

set VolumePath to "smb://acfs5.brunel.ac.uk/eepg/" & username & "/"


-- /! CONNECT TO VOLUME AND OPEN A FINDER WINDOWS TO THIS VOLUME !\--

tell application "Finder"
    try

       mount volume VolumePath

    end try

end tell


delay 2


tell the application "Finder"

    set w to make Finder window to disk username

end tell




Q : What looks like the application ?
A : At first use, a simple box appears. Then, nothing appears except a new Finder window to your personal space.




Q : How to change the username ?
A : The user name is saved in a text file inside the application. To change it, right click on the application and choose "Show Contents". Then edit the file named "user.txt". You can also remove and download again the application, the window above will be displayed at first launch.