0

I know you can minify/condense Javascript or CSS code, but can you do this with AppleScript?

Community
  • 1
  • 1
gadgetmo
  • 3,058
  • 8
  • 27
  • 41
  • I'm not sure (I don't have my Mac handy to test), but I imagine it would all come down to whether or not the carriage return is meaningful in the language. You can probably test it by writing a simple script, minifying by hand, and seeing if it works. If it does, you can probably write an AppleScript program to minify other AppleScript programs :) (Keeping in mind that probably every development tool will try to un-minify (or re-bigulate) it for you.) – David Dec 21 '11 at 14:34

1 Answers1

1

Yeah, line feeds are the equivalent of the semicolon in C. You can use the "Chevron" syntax though.

on run
    main()
end run

on main()
    tell application "Finder"
        display dialog "Hi."
    end tell
end main

converts to:

on «event aevtoapp»
    main()
end «event aevtoapp»

on main()
    tell «class capp» "Finder"
        «event sysodlog» "Hi."
    end tell
end main

There is no enbiggening or rebigulation here, this is actually the raw syntax of the AppleScript. I used the Script Debugger app to switch between the two syntaxes.

Alex Zavatone
  • 4,106
  • 36
  • 54