improved list comprehension + fixed template

* added "if command" to list comprehension, because " -e " + empty
command can't be good
*  fixed some mess in the applescript template