-
Scripting Newb Question: Why isn’t this wrapped in a function?
I’m pretty new to scripting. I’ve only actually written one simple script so far. As I’ve studied other scripts, I find that the code below is repeated at the head of numerous different functions. Why don’t people wrap this in it’s own function? Is it slower that way? Does it make it harder to terminate the script? Or is it just easier to just copy and paste this kind of code? I’m just curious because it seems people who do this kind of thing for a living would make more sophisticated scripting choices. Maybe?
if ((activeItem == null) || !(activeItem instanceof CompItem))
{
alert("Please select or open a composition first." , scriptName);
}else{
//actual function code
{