Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>"What is the best way to combine this applescript into a single line?"</p> </blockquote> <p>Use AppleScript? :-D</p> <p>First, in AppleScript Editor, open the Preferences window and click the option to <code>Show Script menu in menu bar</code>.</p> <p>Then choose <code>Open Scripts Folder</code> from the script menu item up in the upper right of the screen.</p> <p>Create a new AppleScript .scptd document with the following script:</p> <pre><code>tell application "AppleScript Editor" set string_ to text of first document -- make a list with each line of the script set stringLines to paragraphs of string_ set originalDelims to AppleScript's text item delimiters -- add newlines set AppleScript's text item delimiters to "\\n" -- now combine the items in the list using newlines set stringNewlines to stringLines as string set AppleScript's text item delimiters to "\"" set stringNewlines to text items of stringNewlines set AppleScript's text item delimiters to "\\\"" set stringNewlines to stringNewlines as string set AppleScript's text item delimiters to originalDelims set stringNewlines to "@\"" &amp; stringNewlines &amp; "\"" set the clipboard to stringNewlines end tell </code></pre> <p>(Note that this script isn't perfect: it works fine for simple scripts like the one you provided, but isn't able to convert itself). </p> <p>Save that as a script in the Scripts folder you revealed earlier.</p> <p>Then open your script document you want to convert and make it the front document in AppleScript Editor. Then invoke the conversion script by choosing it from the Script menu.</p> <p>Given the script you provided, it should produce the following constant <code>NSString</code>:</p> <pre><code>@"tell application \"Terminal\"\n activate\n set currentTab to do script \"1\"\n do script \"2\" in currentTab\n do script \"3\" in currentTab\n do script \"4\" in currentTab\n delay 0.5\n tell application \"Finder\" to set visible of process \"Terminal\" to false\nend tell\n" </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload