Skip to main content
Question

create alias through the terminal with a custom filename


Forum|alt.badge.img+4

Hey Everyone,

We placing symlinks on the desktop to a few mounted network shares to give the ability to save files to symlink on the desktop. We just noticed office 2011 on osx 10.8.5 doesn't seem to follow symlinks in the save dialog.

Aliasses do seem to work but we'd like to customize the name of the alias that is created like we are doing with symlinks (our sharenames don;t make sense to our end users and renames the shares isn't an option).

Im using the following command in a terminal to create an alias to a mounted networkshare

#!/bin/sh

osascript -e 'tell application "Finder" to make alias file to posix file "/Users/username/Library/ShareMounts/sharename" at desktop '

Applescript/Osascript isn't my area of expertise and google hasn't been helpful so far. Does anyone know of a way to specify a name when creating a alias?

3 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • May 21, 2015

There may be a simpler way to have it all on one line, but the following seems to work

tell application "Finder"
    set mySource to POSIX file "/Users/Shared" as alias
    make new alias to mySource at desktop
    set name of result to "MyAlias"
end tell

You could wrap it into a HEREDOC format, like so:

/usr/bin/osascript << EOF
tell application "Finder"
set mySource to POSIX file "/Users/Shared" as alias
make new alias to mySource at desktop
set name of result to "MyAlias"
end tell
EOF

Forum|alt.badge.img+4
  • Author
  • Contributor
  • 11 replies
  • May 21, 2015

Thanks you much. I'll give this a try first thing in the morning and get back to you :D


Forum|alt.badge.img+13
  • Honored Contributor
  • 550 replies
  • May 21, 2015

whoops wrong window, disregard
LS


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings