When the use command is placed above a call to standard additions — like choose folder or path to — it causes the script to error when compiling. If the command order is reversed, it works. anyone have insight into why and how to work around this problem?
Example 1
Use myLibrary : script "Hello"
set pathToDesktop to (path to desktop folder)
-- Error: A to:desktop can’t go after this path. (highlighting path to desktop)
set pathToDesktop to (path to desktop folder)
use myLibrary : script "Hello"
-- Successful compile
Example 2
Use myLibrary : script "Hello"
set pathToDesktop to choose folder
-- Error: Expected end of line, etc. but found identifier. (highlighting choose folder)
set pathToDesktop to choose folder
use myLibrary : script "Hello"
-- Successful compile
I am running MacOS High Seirra 10.13.1
Model: MacBook Pro with Touchbar (2016)
AppleScript: 2.7
Browser: Safari 604.3.5
Operating System: Other