Home › Forums › OS X Server and Client Discussion › Misc. › Programatically creating an alias on a Mac workstation
- This topic has 3 replies, 2 voices, and was last updated 19 years, 5 months ago by
haxie.
-
AuthorPosts
-
September 30, 2005 at 7:50 am #363414
Anonymous
Guest<font color=black>On an OS X 10.3 workstation, I need to create an alias to a subfolder of a shared folder on a server.
The server has a share called "Products" (smb) with a complicated folder structure underneath it.
On the client (10.3) an alias should be created on a user’s desktop, pointing directly to (for example):
(the share ‘Products’ on the server)/PN1395/subfolder/subfolder/…Is there a way of doing this programatically?
If not, what would be the absolute easiest way for users to do this manually?</font>October 4, 2005 at 7:12 am #363461Anonymous
GuestUnfortunately, I’m not used to coding in AppleScript; and also not that accustomed to the Mac user interface. Would you mind providing a bit more detail on these?
Thanks
October 24, 2005 at 8:49 pm #363776haxie
ParticipantIs the share automatically mounted on the client system?
If so here is a applescript that will handle creating the alias to the share… you could run this as a login hook. Open the script in Script Editor and then copy and paste this code into it.
Read the comments, you will need to change the path to the folder on the share you want an alias to. After you have changed the path, then save the script as an application, which you can then assign as a login item, or script with a login hook. post back if you don’t understand something or if you have troubles getting it to work…(* written by: kdahlin Date: 10/24/05 need the path to where the remote share is mounted on the system. The path needs to be a "Finder" type path, or seperated with ":". If the share is mounted in /Volumes, then the path would be "ShareName:Path:To:SubFolder:You:Want:an:Alias:to" *) -- replace the path below with the one to your share and subfolder property remoteSharePath : "TestShare:TestFolder:TestSubFolder" -- <- change this path tell application "Finder" -- get the path to the current users home folder set homeDirDesktop to home as string set homeDirDesktop to homeDirDesktop & "Desktop:" as string -- check if alias already exists, otherwise a duplicate will be made... (****** ATTENTION you need to change "TestSubFolder" to the name of the folder you are aliasing or to the name of the alias you are creating *****) if exists homeDirDesktop & "TestSubFolder" then -- if the alias exists, we don't do anything - quit log "Alias already exists" quit me else -- create the alias on the desktop try make new alias to remoteSharePath at folder homeDirDesktop on error log "failed to create remote share alias" end try -- you can also choose to name the alias something else with this code: -- make new alias to remoteSharePath at folder homeDirDesktop with properties {name:"Whatever name you want for the alias"} -- if you want to use this code instead, replace the line: -- make new alias to remoteSharePath at folder homeDirDesktop end if end tellhope this helps,
haxie
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed