Here is the script which I use for months to create symlinks.
I assumes that if I don't use ln -s it's because I never found a way to get it to work correctly.
--> error "ln: /Users/<home>/Desktop//: File exists" number 1
#[SCRIPT crée lien symbolique]
(*
# +-+-+-+-+-+
Exécuter ce script ou déposer l'icône d'un fichier
sur son icône (script enregistré en tant qu'application)
crée sur le bureau un lien symbolique vers le fichier.
Save the script as Application on the Desktop.
Drag and drop a file's icon on the script's icon
will create on the Desktop a symlink to the file.
Yvan KOENIG (VALLAURIS, France)
5 janvier 2014
# +-+-+-+-+-+
*)
#=====
# lignes exécutées si on double clique l'icône du script
on run
if my parle_anglais() then
"Choose a file …"
else
"Choisir un fichier …"
end if
set _ to choose file with prompt result
my TraiteLeFichier(_)
end run
#=====
on open sel # sel contient une liste d'alias des éléments
# qu'on a déposés sur l'icône du script (la sélection)
my TraiteLeFichier(item 1 in sel)
end open # fin 2
#=====
on TraiteLeFichier(zefile)
try
set leChemin to zefile as text
tell application "ASObjC Runner" # Thanks to Shane STANLEY
manage file leChemin creating symlink in (path to desktop)
end tell
on error MsgErr number NroErr
if NroErr is not -128 then
beep 2
if my parle_anglais() then
"Oops"
else
" Vu "
end if
tell application "SystemUIServer" to ¬
display dialog "" & NroErr & " : " & MsgErr with icon 0 ¬
buttons {result} giving up after 20
end if
return
end try
end TraiteLeFichier
#=====
on parle_anglais()
return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais
#=====
#[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) mardi 15 juillet 2014 15:20:33