title: Xcode : Applescript app
body: <p>I didn't did an Applescript app on Xcode from ages,</p>
  
  <p>here is my code </p>
  
  <pre><code>script AppDelegate
      property parent : class "NSObject"
  
      -- IBOutlets
      property theWindow : missing value
      property myTextField : missing value
  
      on applicationWillFinishLaunching_(aNotification)
          -- Insert code here to initialize your application before any files are opened 
      end applicationWillFinishLaunching_
  
      on applicationShouldTerminate_(sender)
          -- Insert code here to do any housekeeping before your application quits 
          return current application's NSTerminateNow
      end applicationShouldTerminate_
  
  
      on myButton_(sender)
         -- AppleScript 
      end myButton_
  
      on saveNote_(sender)
      -- AppleScript 
      ​end saveNote_
  
  
  end script
  </code></pre>
  
  <p>but I have this error :</p>
  
  <p>/AppDelegate.applescript:32: error: Expected “end” but found unknown token. (-2741)
  Command /usr/bin/osacompile failed with exit code 1</p>
  
  <p>Can you help me here?</p>
  
  <p>PS here is the AppleScript</p>
  
  <pre><code>to getInputByClass2(theClass, num)
      tell application "Safari"
          set input to do JavaScript "
  document.getElementsByClassName('" &amp; theClass &amp; "')[" &amp; num &amp; "].innerHTML;" in document 1
      end tell
      return input
  end getInputByClass2
  getInputByClass2("field type-string field-DATAID", 0)
  set theText to Unicode text
  set theSource to getInputByClass2("field type-string field-DATAID", 0)
  property leftEdge : "class=\"value\"&gt;"
  property rightEdge : "&lt;/span&gt;"
  set saveTID to text item delimiters
  set text item delimiters to leftEdge
  set classValue to text item 2 of theSource
  set text item delimiters to rightEdge
  set theDATAID to text item 1 of classValue
  set text item delimiters to saveTID
  theDATAID
  </code></pre>
  
  <p>here is the result on xcode</p>
  
  <p><a href="https://i.stack.imgur.com/yUMKo.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yUMKo.jpg" alt="http://s33.postimg.org/9nmzj3m7v/Screen_Shot_2016_05_27_at_18_29_44.jpg"></a></p>