title: How to automate an app to run daily in OSX
body: <p>I am very new to AppleScript programming. This is my code to open an app at 6 PM. I saved this code an as application, and now I want to open this application automatically daily at 6 PM without any user interaction. I want to do this programmatically; no cron job, no Automator, no calendar, no user preferences settings. I want code to trigger it. Is it possible?</p>
  
  <pre><code>set targetTime to "6:00:00 PM"
  
  
  display dialog targetTime -- wait until we reach the target date/time
  repeat while (current date) is less than date targetTime
      -- should be 60
  
  end repeat
  
  
  tell application "Myapp"
  
      activate
  
  end tell
  
  -- get the time in the desired format
  on getTimeInHoursAndMinutes()
  
      -- Get the "hour"
      set timeStr to time string of (current date)
      set Pos to offset of ":" in timeStr
      set theHour to characters 1 thru (Pos - 1) of timeStr as string
      set timeStr to characters (Pos + 1) through end of timeStr as string
  
      -- Get the "minute"
      set Pos to offset of ":" in timeStr
      set theMin to characters 1 thru (Pos - 1) of timeStr as string
      set timeStr to characters (Pos + 1) through end of timeStr as string
  
      --Get "AM or PM"
      set Pos to offset of " " in timeStr
      set theSfx to characters (Pos + 1) through end of timeStr as string
  
      return (**strong text**theHour &amp; ":" &amp; theMin &amp; " " &amp; theSfx) as string
  end getTimeInHoursAndMinutes
  </code></pre>