• 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
Inconsistent results with "do shell script"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inconsistent results with "do shell script"


  • Subject: Inconsistent results with "do shell script"
  • From: Lists <email@hidden>
  • Date: Tue, 15 Jul 2014 00:20:49 -0700

I have been trying to improve my understanding of shell calls in AppleScript with a bit of practice, but have hit a snag. The same shell script will work  sometimes and sometimes will not work. Looking at the logs of success VS no success isn't helping me either. The error is strange (to me).

Here is the script and the two logs for comparison.

set targFile to choose file
set QPP to quoted form of POSIX path of targFile
set targFolder to "~/Desktop/"
set shellScpt to "ln -s " & QPP & " " & targFolder
do shell script shellScpt

This works as expected with a video file in a folder on the desktop. For example, the result of successful run:

tell application "AppleScript Editor"
choose file
--> alias "Sox:Users:j:Desktop:videos:207731393.mp4"
end tell
tell current application
do shell script "ln -s '/Users/j/Desktop/videos/207731393.mp4' ~/Desktop/"
--> ""
end tell

Result:

""
The link was created

This same script however fails when I choose an application in my user application folder. This is the result of a failure:

tell application "AppleScript Editor"
choose file
--> alias "Sox:Users:j:Applications:Apps-Games:Adapter.app:"
end tell
tell current application
do shell script "ln -s '/Users/j/Applications/Apps-Games/Adapter.app/' ~/Desktop/"
--> error "ln: /Users/j/Desktop//: File exists" number 1

Result:

error "ln: /Users/j/Desktop//: File exists" number 1
The link was not created

Any thoughts on how to make it work every time?

Thanks
J
 _______________________________________________
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

  • Follow-Ups:
    • Re: Inconsistent results with "do shell script"
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Eject Bootable Clone
  • Next by Date: Re: Eject Bootable Clone
  • Previous by thread: Re: Eject Bootable Clone
  • Next by thread: Re: Inconsistent results with "do shell script"
  • Index(es):
    • Date
    • Thread