Applescript templates

Hi, how do I use templates in script editor for simple stuff like dialog and text displays and clauses and conditions like if, then, else? Please help.

Answered by Youzhang in 692477022

please, someone answer

Accepted Answer

please, someone answer

If you mark your "answer" as correct, no one will reply.

Templates are more for a script or application skeleton/layout than for small pieces of code. In the Script Editor, the right-click contextual menu has items for inserting various statements; another option would be to create your own scripts for inserting code snippets and place them in the Script Menu, for example:

set theCode to "display dialog \"Question?\" default answer \"answer\" buttons {\"Other\", \"Cancel\", \"OK\"} default button \"OK\" cancel button \"Cancel\" with title \"title\" with icon note giving up after 5"

tell application "Script Editor" to tell front document
   set contents of selection to theCode
   try
      check syntax
   on error errmess
      display alert "Syntax Error" message errmess
   end try
end tell

Also note that these are not social media or chat forums - it may take a while for topics to be read and/or answered.

Applescript templates
 
 
Q