+ Post New Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 31
Scripts Thread, My Docs, Class Shared & Shortcut generator in Coding and Web Development; This script is something of an ambitious one for me as it's intended to take the pain out of the ...
  1. #1
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    My Docs, Class Shared & Shortcut generator

    This script is something of an ambitious one for me as it's intended to take the pain out of the somewhat difficult system we have at this school by which children don't move in a linear fashion with their classmates.

    Basically at some point between years 4 and 6 they are kept in the same class for 2 years. I'm not sure why either but it's the way it's done...


    Anyway I came up with a structure that should allow for the peculiarities of the system so it works something like this:

    H: has been set in their profiles to:
    //server/userdata/Students/Individual/%username%/

    ...but because we wanted to break work into specific years and to provide something of an archive we then want work to go in folders for each academic year under their directory above.

    The script handles this transparently and as far as the children are concerned they start each year with a clean "My Documents" folder.. In truth all that happens is that the script checks the current date and the childrens "My Documents" folder gets redirected to the appropriate year

    //server/userdata/Students/Individual/%username%/[academic_year]/

    eg: ... %username%/2006-07/ => My Documents


    Now where it gets a bit "clever" is that the script automatically creates the relevant folder(s) for that child and if the date is past a certain point in the summer holiday it figures it's a new year and creates the new academic years folder.

    It gets "better" ... Because we're not expecting (nor wanting) the teachers to wade through individual profiles to find their class of kids it also creates a folder of shortcuts in the structure:

    //server/UserData/Staff/Childrens Work/ClassX/[Academic Year]/

    Again it creates the relevant folder if it's missing and based on the OU (childrens user accounts are in OU's for their current class) that the childs account belongs to, a shortcut to the childs work is then created in the relevant class/[year] folder.

    This then allows teachers to go through their classes work this year and in previous years... it also makes the job of archiving work, and/or creating a portfolio of work a LOT easier for the poor TA currently tasked with the role.



    Ok... that's the description... Problem now is that I'm a PHP coder so vbs is totally new and alien to me... I think I've more or less got it right but I could use some help debugging it and checking my logic... so please see the attached... Comments welcome..


    Oh and just to note.. This is intended as a login script and I'm aware it's likely to create an overhead to the system that I can probably tweak.. but right now a 10 or so second login delay is affordable compared to spending hours sorting this lot manually..
    Attached Files Attached Files

  2. #2
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Hmm... noticed a number of inconsistencies in the script so I've done a little editing to get draft #2
    Attached Files Attached Files

  3. #3
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    If anyone is a vbs coder expert or can offer some insight I could use some help at this point..

    I'm getting an "end expected" error for the end line in the script and can't find the cause...

    I'd welcome any "read this and learn" references as well as vbs is something I intend to get my teeth into some more

  4. #4
    ajbritton's Avatar
    Join Date
    Jul 2005
    Location
    Wandsworth
    Posts
    1,632
    Thank Post
    23
    Thanked 75 Times in 45 Posts
    Rep Power
    34

    Re: My Docs, Class Shared & Shortcut generator

    Do I recognise those UserINOU and ComputerInOU functions from somewhere?

  5. #5
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Quote Originally Posted by ajbritton
    Do I recognise those UserINOU and ComputerInOU functions from somewhere?
    Yeah... they were borrowed from other fine resources provided on this forum...

    .. and once it all works I'll be sure and spread around the credit

  6. #6

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124

    Re: My Docs, Class Shared & Shortcut generator

    Not an expert vbcoder but I can spot "if" and "end if" that don't match:
    If fso.FolderExists(scFolLocYr) Then
    ' Do nothing, share already exists
    Else If scFolLoc <> Nothing Then
    CreateDirs scFolLocYr
    Else
    scFolLocYr = Nothing
    ' Do nothing (not valid group)
    End If

    I think needs to be

    If fso.FolderExists(scFolLocYr) Then
    ' Do nothing, share already exists
    Else
    If scFolLoc <> Nothing Then
    CreateDirs scFolLocYr
    end if
    Else
    scFolLocYr = Nothing
    ' Do nothing (not valid group)
    End If

    - every "if" needs a matching "end if" unless it's all on one line (ie you can do if x=3 then wscript.echo "x=3"

    I *think* what you're trying to do might be easier expressed as:

    If not(fso.FolderExists(scFolLocYr)) and scFolLoc <> Nothing Then
    CreateDirs scFolLocYr
    End If

    KISS very much applies here - if you can see what's going on in just a few lines then it'll make it much easier to debug! My rule (which I break too often) is that the main flow of a script should fit on a screen; it can call functions and sub-routines and each of them should also fit on a screen if possible.

    the other thing is to use an editor that makes indenting easy - I use context (www.context.cx) which is free and quite good. If you get the indents right then it's easy to spot when you miss end if, next, loop etc.

  7. #7
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Cheers Steve..

    You made me go away and look up a few things and I think it was actually down to the else if being spaced out rather than elseif which is apparently valid.

    I take your point re: the simplification which I'll do when I've got it working but more than anything else I needed to see my logic clearly which the original drafts do quite well.

    Thanks for pointing me in the right direction and as to editor, I know what you mean there, I paid out for UltraEdit Studio which has been invaluable in my PHp coding and pretty good for this too..

    Thanks again...

    Martin

  8. #8
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Ok... had a chance to do some debugging and got it to this daft which is version #3 now...


    Going to be giving it a go tomorrow with a single class to see if it does what it should...

    In the mean time if anyone wants to see if they can spot any problems or suggest improvements... please do..
    Attached Files Attached Files

  9. #9
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Right...

    Daft #4 and having finally debugged the thing over the course of the day there's a few things to note with this latest incarnation..

    1. If the file system hasn't been run before it will take quite a while for the script to create most of the base folders.

    2. Due to 1. The script has delays built in that keep on checking for the folder to be created before moving on to the next stage..

    3. This in turn means that login time takes a while...


    All in all though the system will basically run smoothly once the folders have been created at the beginning of the year (or first login)... and I figure it'll be worth creating a seperate script to be run during the summer holidays that essentially runs through the AD and creates all the folders for the existing users... Any new, last minute additions are then covered later on... But that's a whole other story
    Attached Files Attached Files

  10. #10
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Right.. new draft (untested) but tidied up some to remove some unnecessary duplication, etc...

    Should reduce the load somewhat and a number of unnecessary drive mappings...
    Attached Files Attached Files

  11. #11
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Bugger, bugger, bugger...

    As part of my deployment with this I was intending to use mandatory profiles to help reduce the load.. Unfortunately this doesn't work as mandatory profiles seem to lock the registry keys my script uses for stuff like "My Documents" to the "User Default" profile..

    Looking into a resolution for this...

  12. #12
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    I need to rewrite the original scripts code as there's a dumb error in there but just quickly ...

    This new script attached is an admin "run manually" script that allows you to create the folders manually without having to rely on the login script.

    It parses the LDAP structure (which you need to set) and then creates any missing folders.

    Useful to run when you've done all your AD user account creations/import/etc....
    Attached Files Attached Files

  13. #13
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: My Docs, Class Shared & Shortcut generator

    this looks really good and i would love to know what to change so i can use it on my network.

  14. #14
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Quote Originally Posted by alonebfg
    this looks really good and i would love to know what to change so i can use it on my network.
    I'll get it all updated and with documentation when I've had a chance to fix up the original script (which is just plain pants atm).

    No sense in just having one without the other eh?

  15. #15
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    118

    Re: My Docs, Class Shared & Shortcut generator

    Ok.. don't hold your breath but after working with this some more I've realised that I neglected to deal with permissions issues (ie: sharing the shared folder between class OU's and a whole lot more.


    So I've been pretty much re-writing the code on this little lot and wouldn't advise anyone to use this right now.


    That said once done the script should do the following:

    • Read the OU's contained in a specific OU (eg: ou=classx,ou=classes)
    • Append any ou user containers into a security group for that class
    • Create all the folders required with academic year sub-folders to keep everything organised, shared folders for the whole class
    • set permissions for the class shared folder so the class security group can access it (and the staff security group)
    • Create shortcuts to the childrens individual folders for each year in a staff folder with folders for each class. Making it easy to locate childrens work for a given year.
    • Make the bed, cook the dinner and offer bug rubs...


SHARE:
+ Post New Thread
Page 1 of 3 123 LastLast

Similar Threads

  1. Educational Jargon Generator
    By beeswax in forum Jokes/Interweb Things
    Replies: 11
    Last Post: 6th January 2008, 05:45 PM
  2. BAD dotNet docs
    By PiqueABoo in forum Coding
    Replies: 1
    Last Post: 10th November 2007, 02:54 PM
  3. My Docs access problem
    By Ste_Harve in forum Windows
    Replies: 2
    Last Post: 30th August 2007, 12:32 PM
  4. Cartoon face generator
    By _Bat_ in forum General Chat
    Replies: 5
    Last Post: 7th February 2007, 12:12 PM
  5. Class Server Authentication and Class Sites
    By dagza in forum Virtual Learning Platforms
    Replies: 2
    Last Post: 15th November 2006, 12:05 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •