I use this script to get file name of current running script file name:
var app = Application.currentApplication(); app.includeStandardAdditions = true; app.