Applescript: do shell script fails when using foundation framework

Discussion in 'Mac Programming' started by kimaldis, Sep 28, 2016.

  1. kimaldis macrumors newbie

    kimaldis

    Joined:
    Sep 28, 2016
    #1
    If I add use framework "Foundation" to an applescript, do shell script no longer works. I get an error "Syntax Error, Expected end of line, etc. but found identifier." with 'shell' highlighted in the script. If I remove the 'use framework' line or the 'use framework' line, the script works again.

    Any thoughts?

    use framework "Foundation"
    do shell script "basename a/b/c/d/file.ext" -- fails, syntax error.


    thanks.
     
  2. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
    If your script has any use statements, you need to explicitly include scripting additions - see the Control Statements Reference of the AppleScript Language Guide.
     
  3. kimaldis thread starter macrumors newbie

    kimaldis

    Joined:
    Sep 28, 2016

Share This Page