Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript syntax help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="jakeroberts" data-source="post: 392342" data-attributes="member: 29740"><p>Hello, I am working on a script for myself and I am stuck on a couple of things.</p><p>I have it greet me and announce the time on boot but I want it to exclude the seconds from the time when it says it aloud. </p><p></p><p>The second problem is that I have it start my favorite apps on boot, which works fine but I want them to start minimized. I am posting the entire script, thanks in advance.</p><p></p><p></p><p>--say time commands</p><p>-- need to exclude seconds</p><p>set theDate to current date</p><p>set theDay to weekday of theDate</p><p>set theTime to time of theDate</p><p></p><p>if the theTime > 0 and the theTime < 43200 then say ¬</p><p> "Good morning Jake! It's " & theDay & "."</p><p>if the theTime > 43199 and the theTime < 57600 then say ¬</p><p> "Good afternoon Jake!"</p><p>if the theTime > 57599 and the theTime < 64800 then say ¬</p><p> "Good evening Jake!"</p><p>if the theTime > 64799 and the theTime < 86400 then say ¬</p><p> "It's " & theDay & " night."</p><p>say "the time is"</p><p>say (time string of (current date))</p><p></p><p></p><p>tell application "Mail"</p><p> check for new mail</p><p> </p><p> </p><p> set unreadCount to unread count of inbox</p><p> </p><p> </p><p> if unreadCount is equal to 0 then say ¬</p><p> "You have no new messages!"</p><p> if unreadCount is equal to 1 then say ¬</p><p> "You have a new message!"</p><p> if unreadCount is greater than 1 then say ¬</p><p> "You have " & unreadCount & " new messages!"</p><p> delay 2</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> -- app open commands</p><p> </p><p> tell application "Terminal" to activate</p><p> --tell application "Terminal" to close window 0 I tried this line but it returns errors.</p><p> </p><p> </p><p> </p><p> </p><p> tell application "Safari" to activate</p><p> --tell application "Safari" to close window 0</p><p> </p><p> </p><p> </p><p> </p><p> tell application "Firefox" to activate</p><p> --tell application "Firefox" to close window 0</p><p> </p><p> </p><p> </p><p> --check mail commands</p><p> </p><p> </p><p> </p><p> </p><p> -- lets me know it finished without errors</p><p> say "script end"</p><p>end tell</p></blockquote><p></p>
[QUOTE="jakeroberts, post: 392342, member: 29740"] Hello, I am working on a script for myself and I am stuck on a couple of things. I have it greet me and announce the time on boot but I want it to exclude the seconds from the time when it says it aloud. The second problem is that I have it start my favorite apps on boot, which works fine but I want them to start minimized. I am posting the entire script, thanks in advance. --say time commands -- need to exclude seconds set theDate to current date set theDay to weekday of theDate set theTime to time of theDate if the theTime > 0 and the theTime < 43200 then say ¬ "Good morning Jake! It's " & theDay & "." if the theTime > 43199 and the theTime < 57600 then say ¬ "Good afternoon Jake!" if the theTime > 57599 and the theTime < 64800 then say ¬ "Good evening Jake!" if the theTime > 64799 and the theTime < 86400 then say ¬ "It's " & theDay & " night." say "the time is" say (time string of (current date)) tell application "Mail" check for new mail set unreadCount to unread count of inbox if unreadCount is equal to 0 then say ¬ "You have no new messages!" if unreadCount is equal to 1 then say ¬ "You have a new message!" if unreadCount is greater than 1 then say ¬ "You have " & unreadCount & " new messages!" delay 2 -- app open commands tell application "Terminal" to activate --tell application "Terminal" to close window 0 I tried this line but it returns errors. tell application "Safari" to activate --tell application "Safari" to close window 0 tell application "Firefox" to activate --tell application "Firefox" to close window 0 --check mail commands -- lets me know it finished without errors say "script end" end tell [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript syntax help
Top