Applescript Good Morning abort feature

Discussion in 'macOS' started by derekshull, May 9, 2012.

  1. derekshull macrumors newbie

    Joined:
    May 7, 2012
    #1
    So I have this really long script and I'm using dragon dictate to trigger the script to activate and the script says good morning and tells me the weather, reads me any new emails, tells me my agenda for today, reads me news headlines from specific rss feeds, and tells me the current time. I'm using a revolabs usb mic to do it and was wondering if there was a way to say "abort" or some other trigger word to stop the computer from mid way through?

    It'd be quite helpful.
     
  2. BrianBaughn macrumors 601

    BrianBaughn

    Joined:
    Feb 13, 2011
    Location:
    Baltimore, Maryland
    #2
    I would think that your original script is in application form, then you could make another script to quit that application.
     
  3. derekshull thread starter macrumors newbie

    Joined:
    May 7, 2012
  4. BrianBaughn macrumors 601

    BrianBaughn

    Joined:
    Feb 13, 2011
    Location:
    Baltimore, Maryland
    #4
    Sorry. Maybe I should get more info...

    Did you set up the script? Or the action to make Dragon trigger it? What is the file extension of the script?
     
  5. derekshull thread starter macrumors newbie

    Joined:
    May 7, 2012
    #5
    Heres the script:

    Code:
    tell application "Mail"
    	
    	set unreadMessages to (get every message of mailbox "INBOX" of account "Gmail" whose read status is false)
    	
    	set numberofmessages to (count of (every message of mailbox "INBOX" of account "Gmail" whose read status is false))
    	
    	if (count of (every message of mailbox "INBOX" of account "Gmail" whose read status is false)) is 1 then
    		tell application "Mail"
    			say "There is only " & numberofmessages & " new email"
    			repeat with eachMessage in unreadMessages
    				delay 1
    				say "From! "
    				say (get sender of eachMessage)
    				say "Subject."
    				say (get subject of eachMessage)
    				say "Message."
    				say (get content of eachMessage)
    				set read status of eachMessage to true
    			end repeat
    		end tell
    	else if (count of (every message of mailbox "INBOX" of account "Gmail" whose read status is false)) is greater than 1 then
    		tell application "Mail"
    			say "There are " & numberofmessages & " new messages"
    			repeat with eachMessage in unreadMessages
    				delay 1
    				say "From! "
    				say (get sender of eachMessage)
    				say "Subject."
    				say (get subject of eachMessage)
    				say "Message."
    				say (get content of eachMessage)
    				set read status of eachMessage to true
    			end repeat
    		end tell
    	else
    		say "There are no new messages"
    	end if
    end tell
    
    when I say "read my emails" it reads them to me. What I want is to be able to say "abort" and it'll immediately stop reading me my emails.
     

Share This Page