Refactor apple script a bit

Refactored the apple scripts of some functions to fit into one line without
sacrificing readability. This wastes less vertical space and should be easier
to understand. Hope you like it :)