• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inconsistent results with "do shell script"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistent results with "do shell script"


  • Subject: Re: Inconsistent results with "do shell script"
  • From: "koenig.yvan" <email@hidden>
  • Date: Tue, 15 Jul 2014 16:35:07 +0200


Le 15/07/2014 à 16:24, Shane Stanley <email@hidden> a écrit :

On 15 Jul 2014, at 11:21 pm, koenig.yvan <email@hidden> wrote:

Here, running OS X 10.9.4

In that case you can use an ASObjC script library, calling it like this:

tell script "<lib name>" to createSymlinkInFolder:"~/Desktop/" linkingTo:"~/Desktop/Explorer stuff/General Lib.asobjcex3doc"

The library should contain:

use framework "Foundation"
on createSymLinkInFolder:folderPath linkingTo:oldPath
-- make paths into NSStrings so we can manipulate them
set folderPathNSString to current application's NSString's stringWithString:folderPath
set oldPathNSString to current application's NSString's stringWithString:oldPath
-- add name of existing file to destination path
set newPath to folderPathNSString's stringByAppendingPathComponent:(oldPathNSString's lastPathComponent())
-- expand tildes
set newPath to newPath's stringByStandardizingPath()
set oldPath to oldPathNSString's stringByStandardizingPath()
-- make link
set theNSFileManager to current application's NSFileManager's defaultManager()
set {theResult, theError} to theNSFileManager's createSymbolicLinkAtPath:newPath withDestinationPath:oldPath |error|:(reference)
if not theResult as boolean then
error (theError's localizedDescription() as text)
end if
return theResult as boolean
end createSymLinkInFolder:linkingTo:

Now we just need someone to time the various alternatives ;-)

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

Hello Shane.

As ASObjC Runner is loaded everyday during the startup process I guess that it's faster than the library scheme but one never knows.

Yvan KOENIG (VALLAURIS, France) mardi 15 juillet 2014 16:35:02



 _______________________________________________
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

References: 
 >Inconsistent results with "do shell script" (From: Lists <email@hidden>)
 >Re: Inconsistent results with "do shell script" (From: Axel Luttgens <email@hidden>)
 >Re: Inconsistent results with "do shell script" (From: "koenig.yvan" <email@hidden>)
 >Re: Inconsistent results with "do shell script" (From: Shane Stanley <email@hidden>)

  • Prev by Date: Apple ID Bulk Creator
  • Next by Date: Automator via Applescript?
  • Previous by thread: Re: Inconsistent results with "do shell script"
  • Next by thread: Apple ID Bulk Creator
  • Index(es):
    • Date
    • Thread