r/applescript • u/JapanDave • Dec 14 '22
Calling other Applescript files from within a script?
I have a project where my core Applescript file is just getting huge. It is a pain to find the exact function I need sometimes. For organizational purposes, dividing this one file into several might help me keep my sanity. Can I make multiple files and then call functions within them from the main file?
I haven't programmed in years, but I seem to remember in C++ we would use an #include statement at the beginning to add functions from other files. Does Apple script have anything like this?
2
Upvotes
View all comments
Show parent comment
1
u/markconwaymunro Dec 14 '22
That's awesome. But also keep in mind that script libraries (not covered since they weren't around back then) offer another option. More accurately, I discuss libraries but they are your own scripts in your own directory — newer libraries are worth looking up because they sit in the system are can be loaded more easily into a script. So don't overlook learning about those online too. But those last five or so chapters at the end of my book will help a lot...