0

I am attempting to use Xcode and AppleScript-objC to zip a folder containing some network test files but get an error on this section of code.

set homeFolder to (path to home folder)
set homeDesktop to (POSIX file (POSIX path of homeFolder & "/Desktop/NetworkTestResults/"))

tell application "Finder"
    set theItem to homeDesktop as alias
    set itemPath to quoted form of POSIX path of theItem
    set fileName to name of theItem
    set theFolder to POSIX path of (container of theItem as alias)
    set zipFile to quoted form of (theFolder & fileName & ".zip")
    do shell script "zip -jr " & zipFile & " " & itemPath
end tell

The error text is "Can't make <> into type alias. (error -1700)

Any thoughts on how to correct/work around this?

Thanks for the assist.

8
  • Error did not format correctly, should say "script" in the middle of <<>> Commented Jul 28, 2017 at 19:30
  • Script works for me as long as NetworkTestResults exists. Please show the header of your the file and try to log output (--> homedesktop). In addition you can shorten your code as (path to desktop) will directly give you the path of the current users desktop. Commented Jul 29, 2017 at 5:30
  • The script has always worked in AppleScript. my issue is I get the error when putting this script into Xcode. It does not want to use the Alias keyword. Commented Jul 29, 2017 at 20:22
  • Maybe its coercing as homeDesktop is recognized as script. Try add 'as text' at the end of your 2. line. Commented Jul 29, 2017 at 23:39
  • ... and in addition - is it an applescript xcode application? or swift/objective c with applescript implemented? Commented Jul 30, 2017 at 14:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.