Re: Make Symlink in AppleScript
Re: Make Symlink in AppleScript
- Subject: Re: Make Symlink in AppleScript
- From: iKel via AppleScript-Users <email@hidden>
- Date: Mon, 25 May 2020 13:23:04 -0500
Hey Yvan!
Somehow I just missed those lines at the very beginning, probably when
I copied from Mail. Sorry about that, I should have seen it! The script is
working fine now. I appreciate your help.
Thanks again,
Kell
> On May 15, 2020, at 8:31 PM, email@hidden wrote:
>
> Send AppleScript-Users mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.apple.com/mailman/listinfo/applescript-users
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of AppleScript-Users digest..."
>
>
> Today's Topics:
>
> 1. Make Symlink in AppleScript (?iKel)
> 2. Re: Make Symlink in AppleScript (Yvan KOENIG)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 15 May 2020 19:34:25 -0500
> From: ?iKel <email@hidden>
> To: Applescript-users list <email@hidden>
> Cc: email@hidden
> Subject: Make Symlink in AppleScript
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> I apologize in advance for my delay in response, but just wanted to give a
> shout out to those who helped me on this.
>
> Clark,
>
> Your advice really helped. I was able to figure out after I executed it
> in Terminal. Setting the variable as the entire shell command line is a great
> practice to get into! Thanks for the direction. I made a rudimentary script,
> but it?s a start. Again, I appreciate it.
>
> Toto,
>
> I appreciate your advice. I am still getting the grasp of handlers. So,
> I appreciate the link; I have added to my desktop to peruse through it.
> Thanks for the suggestion of using 'on open? rather than ?in run?. I now have
> a working script. Thanks again!
>
> Yvan,
> I appreciate your script. I also went through your script and
> translated the French because I am weird like that and wanted to better
> understand the script in its entirety and I just like languages so I wanted
> to learn new words. Of course, I did this with translator so it may not be
> 100% accurate, so feel free to correct me if I am wrong.
> I unfortunately get this error message: -1708 : NSFileManager doesn?t
> understand the ?defaultManager? message. I am not sure if I just haven?t
> copied it incorrectly but I posted the code below, if you have time, any help
> would be much appreciated! Thanks as always!
>
>
> So, I have now three working scripts and have learned more and have gained
> various techniques to utilize. Thanks so much!
>
> best regards
>
> (*
> #+-+-+-+-+-+
> Ex?cuter ce script ou d?poser l'c?ne d'un fichier
> sur son ic?ne (script enreigistr? 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.
>
> #+-+-+-+-+-+
> *)
>
>
> #=====
>
> #lignes ex?cut?s si on double clique l'ic?ne du script
> #lines executed if we double click the script icon
> (*
> note: 'du' in French means something entirely different and is not to be
> confused with the German word for the singular, informal usage of ?you?
> *)
> on run
> if my parle_anglais() then
> --'parle anglais' means 'speak English'
> "Choose a file ?"
> else
> "Choisir un fichier ?"
> --means choose a file
> end if
> set _ to choose file with prompt result
> my TraiteLeFichier(_)
> --process file
> end run
>
> #=====
>
> on open sel # sel contient une list d'alias des ?l?lements
> --cotains a list of element aliases
> #qu'on a d?pos?s sur l'c?ne du script (la s?lection)
> -- that we placed on the script icon (the selection)
> my TraiteLeFichier(item 1 in sel)
> --process file
> end open # fin 2
>
> #=====
>
>
> on TraiteLeFichier(zefile)
> --process file
> try
> set leChemin to POSIX path of zefile
> --leChemin translates to "the path"
> --zefile ??
> tell application "System Events" to set fName to name of zefile
> #ADDED
> set path2link to (path to desktop as text) & fName
> my createSymlink:(POSIX path of path2link) pointingTo:leChemin
> on error MsgErr number NroErr
> if NroErr is not -128 then
> beep 2
> if my parle_anglais() then
> "Oops"
> else
> "Vu"
> --got it or understood or seen as in D?j? Vu
> (already seen)?
> 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
>
> #=====
>
> on createSymlink:newPath pointingTo:targetPath
> log newPath
> log targetPath
> set fileManager to current application's NSFileManager's
> defaultManager()
> set theResult to fileManager's createSymbolicLinkAtPath:newPath
> withDestinationPath:targetPath |error|:(missing value)
> return (theResult as boolean)
> end createSymlink:pointingTo:
>
> #=====
>
> #[/SCRIPT]
>
>
>
> Live your life as an exclamation rather than an explanation. -Sir Isaac
> Newton
>
> iKel
> email@hidden
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20200515/191950b1/attachment.htm>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 16 May 2020 03:31:52 +0200
> From: Yvan KOENIG <email@hidden>
> To: liste AppleScript US <email@hidden>
> Subject: Re: Make Symlink in AppleScript
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> I apologizes but in my message there were 6 lines which you dropped.
>
> They make the difference.
>
> At the very beginning were:
>
> use AppleScript version "2.4"
> use framework "Foundation"
> use scripting additions
>
>
> #[SCRIPT cr?e lien symbolique]
>
>
> I don't understand why you dropped them.
>
>
> Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi
> 16 mai 2020 03:30:34
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <https://lists.apple.com/mailman/private/applescript-users/attachments/20200516/9e014319/attachment.htm>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> AppleScript-Users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/applescript-users
>
>
> ------------------------------
>
> End of AppleScript-Users Digest, Vol 17, Issue 65
> *************************************************
_______________________________________________
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