• 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: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?


  • Subject: Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
  • From: Emmanuel LEVY <email@hidden>
  • Date: Tue, 20 Jul 2010 23:02:11 +0200

On Jul 20, 2010, at 7:43 PM, Mark J. Reed wrote:

I'm confused by the use of AppleScript at all here.

Obvious.

Though, in case anyone is interested, we make Files.osax to make it easier to write such programs in AppleScript, even if you don't know about quoted form. Files.osax is distributed on a just-ask-me basis.

For instance, Files.osax has: mkdir for mkdir, fileremove for rm, create symlink for ln, etc. Of course it's much faster (50 x for one test with fileremove vs do shell script rm) than do shell script "rm" since "do shell script has to open a Terminal", whatever it means.

Emmanuel



set -o braceexpand rm -f ~/Desktop/{Home,{Student,Faculty}Share}

mkdir -p /Volumes/UNCHome
ln -s /Volumes/UNCHome ~/Desktop/Home

case "$current_group" in
*gStudents*)
# home directory mounting and alias for students clients
mount_smbfs -N "//studentserver.pcsd.monroe.edu/$current_user\ $" \
/Volumes/UNCHome
;;
*)
# faculty and staff login items
mount_smbfs -N "//facultyserver.pcsd.monroe.edu/$current_user\ $" \
/Volumes/UNCHome
mkdir -p /Volumes/FacultyShare
mount_smbfs -N //facultyserver.monroe.edu/shared \
/Volumes/FacultyShare
ln -s /Volumes/FacultyShare ~/Desktop/FacultyShare
;;
esac



# student, faculty and staff login items

mkdir -p /Volumes/StudentShare
mount_smbfs -N //studentserver.pcsd.monroe.edu/shared \
                        /Volumes/StudentShare
ln -s /Volumes/StudentShare ~/Desktop/StudentShare

On Tue, Jul 20, 2010 at 9:14 AM, Emmanuel LEVY <email@hidden> wrote:
I'm not sure I understand all of your issues - starting with the fact that I
don't see where the Gregorian calendar enter in - but if this can help, a
line like:


do shell script ("ln -s /Volumes/FacultyShare /Users/'" & current_muser &
"'/Desktop/FacultyShare")


should absolutely be avoided, as this will make uncontrolable situations
when current_muser includes a space. Do use "quoted form" around paths, like
in :


-- untested
   do shell script ("ln -s " & quote form of ("/Volumes/FacultyShare
/Users/'" & current_muser & "'/Desktop/FacultyShare") )

Emmanuel


Hello,

I am not very adept to scripting, but recently the AD techs changed many
things on me, especially the paths to student home folders and shares in AD.


I used to have a script that worked, being we were all 10.4/10.5 and had
the paths set up to work, being 10.4 was not able to see as deep into
layers.


As shown:

(*

     This script tests the group of the user and the version of

     of OS X then mounts the proper shared volumes and creates

an alias on the desktop. It also tests to see if facultyserver exists
and


     if it does not it will not run the mount part of the script

*)



set j to 4 --Number of times to ping the server

repeat with i from 0 to j

        if i < j then

                  try

                           do shell script "ping -c 1 facultyserver"

exit repeat --If the ping was successful, jump
to the end of the repeat


                  on error

                           if i = (j - 1) then

error number -128 --Exits the script
quietly


                           end if

                  end try

        end if

end repeat






set current_user to (do shell script "whoami | sed 's/ / /g'") as text


set current_muser to (do shell script "whoami") as text

set current_os to (do shell script "uname -r") as text

set current_group to (do shell script "id") as text



(* clear old settings *)

tell application "Finder"

        try

                  do shell script ("rm /Users/'" & current_muser &
"'/Desktop/Home")

        end try

        try

                  do shell script ("rm /Users/'" & current_muser &
"'/Desktop/StudentShare")

        end try

        try

                  do shell script ("rm /Users/'" & current_muser &
"'/Desktop/FacultyShare")

        end try



        (* mounts and aliases *)

        try

                  if current_group does not contain "gStudents" then

                           (* faculty and staff login items *)

(* home directory mounting and alias for 10.4
faculty clients *)


do shell script ("mkdir /Volumes/ UNCHome")

do shell script ("mount_smbfs -N
//facultyserver.pcsd.monroe.edu/" & current_user & "$ /Volumes/ UNCHome")


                           do shell script ("ln -s /Volumes/UNCHome
/Users/'" & current_muser & "'/Desktop/Home")





(* facultyserver shared mounting for faculty
and staff *)


do shell script ("mkdir /Volumes/ FacultyShare")

                           do shell script ("mount_smbfs -N
//facultyserver.monroe.edu/shared /Volumes/FacultyShare")

do shell script ("ln -s /Volumes/ FacultyShare
/Users/'" & current_muser & "'/Desktop/FacultyShare")


                  else

(* home directory mounting and alias for 10.4
students clients *)


do shell script ("mkdir /Volumes/ UNCHome")

do shell script ("mount_smbfs -N
//studentserver.pcsd.monroe.edu/" & current_user & "$ /Volumes/ UNCHome")


                           do shell script ("ln -s /Volumes/UNCHome
/Users/'" & current_muser & "'/Desktop/Home")

                  end if

                  (* student, faculty and staff login items *)



                  (* studentserver mounting for faculty, staff and
students *)

                  do shell script ("mkdir /Volumes/StudentShare")

                  do shell script ("mount_smbfs -N
//studentserver.pcsd.monroe.edu/shared /Volumes/StudentShare")

do shell script ("ln -s /Volumes/StudentShare / Users/'"
& current_muser & "'/Desktop/StudentShare")



The student pathway now includes a grad year, so path is now different.
(The example Leo, is my cat...so no student info was given out)


For student Leo Staub I have the following for home and share:

/Volumes/Home/2017/Staub\ Leo

/Volumes/Shared

I do not believe the path for the "Shared" has changed, aside from the
home path of the student themselves. However, I think the "\ " slash +
space is part of the issue.


In all our findings, we see many people having problems with specifying
paths with (escapes) getting , etc. Found some resolve to using two
\\...but still having problems.


Being, when a user logs in, the dock has a link to their home....is there
a scripted way or a way to "show" the user's home on the desktop?
The main reason for this...saving a file in MS Word...if link shows
on desktop to home...can save as to desktop/home/2017/Staub_Leo to save a
file to their network H drive.


If anyone knows how to accomplish this or if you know of great
resources...that have integrated AD 2008, that may have already come up with
fix or option...that is also great. Thanks so much!


Jerry Staub ACSP, MCP
Monroe #1 BOCES Sr. Network Technician
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden )
Help/Unsubscribe/Update your Subscription:


Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden )
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden




--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
      • From: CYB <email@hidden>
    • Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Has anyone created a script for AD 2008 home and shares in OS X.5/6? (From: email@hidden)
 >Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6? (From: Emmanuel LEVY <email@hidden>)
 >Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6? (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Re. Floating On Screen Clock
  • Next by Date: Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
  • Previous by thread: Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
  • Next by thread: Re: Has anyone created a script for AD 2008 home and shares in OS X.5/6?
  • Index(es):
    • Date
    • Thread