Using applescript to edit a server variable - email

I do not know if I am asking this correctly (but none of my searches anywhere yielded an answer).
I'll try my best to explain;
I've created an Applescript that is used in a mail client (Mac Mail and MS Outlook).
Basically when an email is recieved, it checks the subject, if the subject contains "whatever" then the script executes.
This script asks if you'd like to send an auto-response. If you click no, nothing happens. If you click yes, one is sent. Simple enough right?
Well, the problem I ran into is 20 people all said yes at the same time, sending 20 auto-generated emails.
I am attempting to find SOMEWAY to have "it" check to see if someone has already clicked yes. Does anyone have any insight? Am I going too far outside the scope of Applescript? If so, any alternatives would be greatly appreciated.

You need some centralized way to keep track when a yes is clicked. So a simple text file on the server may do the job. What I'm thinking is that when someone clicks yes to send the auto-responce then the first thing the script does is check the central file to see if anyone else has already clicked yes. If the file does have a yes then a new dialog pops up and lets the user know the email was already responded to and of course that yes does not respond. If the file does not have a yes then the script writes a yes for that email to the file, then sends the response.
You would need some way to distinguish between the emails that come in at different times so you would check the central file for this unique email property... something that is unique to each email but the same for everyone that receives it. If there is not a unique property then maybe a time based check would work. For example you could write the time-of-day to the file, and you don't send a response if the file contains a time within 30 minutes or some other suitable time period.
I hope that gives you some ideas. Good luck.

Related

Need Script Code for Automating Emails Based on Cell Input in Google Sheets

I am trying to create a script that will auto-email a person. Basically, this sheet is going to have a list of items and track those items, and I need to assign each item when it comes it. When I assign it to a person's name, I want the script to then email that person. There are only about 15 people, but I assume I would need a script for each person aka if I put "Sally" in the sheet, there is a script to now email "Sally" to say she has been added to this task.
Ideally, I would like a way to also generate an email again to "Sally" if I update her task, add a comment to it, or do another input to do some sort of follow-up.
Any help would be appreciated immensely!
It wont be good to directly post the complete solution but I will mention the required functionalities which I get in my mind , please use them to solve your task:
onEdit(e) - use this to trigger a particular set of functions whenever a particular range or cell value is changed(it may be automated or manual both can trigger this function) look into the official documentation for how to detect the changes occurred in which cell(https://developers.google.com/apps-script/guides/triggers)
once the new task is assigned to a person(for first time) send an email to that person using GmailApp(install the library in app script) , get the ThreadById of this email and store it into the sheet along the same row, if any changes are made afterwords like adding comments or something,use this threadId to reply to the same email using "thread.reply"(How do you reply to email thread with google Mailapp?)
I think you have also asked how to make the system dynamic, I mean you are right now coding as if each member needs a code for his/her entry. Please study a bit deeper you will easily find an approach to make it dynamic using the onEdit and some for loops as the way you are thinking is not recommended in automation scenarios.

Extracting attachments from mail box using AutoHotKey

I need to extract the attachments(pdf and .xlsx) from mail box using auto hot key.
Can somebody elaborate the steps for achieving this?
Any links could also be of help.
Thanks
#dheerendra
First, figure out how to do it in a stepwise fashion with just the mouse and/or keyboard (look for shortcut keys or accelerator keys or hot keys - those things with underlines under them). Once you can do it manually, secondly, use AutoHotKey (or any other scripting utility) to automate those steps. These links can help.
AutoHotKey can replicate Mouse clicks at locations:
https://www.autohotkey.com/docs/commands/Click.htm
AutoHotKey can replicate sending Keys from the keyboard:
https://www.autohotkey.com/docs/commands/Send.htm
That should do it, now you just put the steps into the script, maybe with some wait times between steps, or maybe with some error checking, or maybe add some flow control logic, or perhaps get and respond to additional user input, or even a GUI.
But if you have any trouble, show us what you tried (just enough of your code to disclose the troublesome part), and tell us what you expected to happen, and then tell us what actually happened.
EDIT: (Examples of the improvements)
E.g., you could use control logic to save in a place and name it depending on the sender or subject, or a category:
https://www.autohotkey.com/docs/commands/IfExpression.htm
Or you could get simple user input to determine where to save it and what to call it:
https://www.autohotkey.com/docs/commands/InputBox.htm
Or even create a full blown application with a GUI and connections to other data, and use that to establish a complete workflow process.
https://www.autohotkey.com/docs/commands/Gui.htm
Also, you didn't say what Mail client you are using, but I should mention that in addition to scripting mouse and keyboard actions, AutoHotKey lets you easily interact with Microsoft Outlook com interface which can easily expose email message objects and their attachments.
https://www.autohotkey.com/docs/commands/ComObjCreate.htm
Good luck, and Hth,

How do I build a script that automatically sends out emails?

So I've done some research on the topic, but I cannot seem to figure out how to get the emails to send. This is the sheet I've been using: https://docs.google.com/a/taktical.co/spreadsheets/d/18GsFLLUCCAba82Teyd4nI8XSuNwEBvunjpQeNdYY-6U/edit#gid=0
I want to be able to pull the information from the first sheet, and have the recipient email set to Contact Email 1. I also need an if statement that says if any cell in row D says "not found", to just simply not send the email.
Any help here would be greatly appreciated :)
I splitted your problem into 3 distinct areas, with suggestions on how to solve it.
Consider using the gspread API to read the data from your Google Doc into a Python script.
Then to send email with Python, see Python Documentation: Email examples.
Finally, to automatically run this Python script it kind of depends on which OS you are using. In Linux you could set it up as a cronjob or just autostart it to run all the time.
I hope this will get you somewhere.

create hyperlink in sms in iPhone

Is it possible to create a hyperlink in an sms in an iPhone?
For example, if I want the word 'foo' hyperlinked in HTML then I'll write foo in a normal situation.
If I want to have a certain word in my sms to be hyperlinked to something, is there any way I can do this? Like "I have a surprise for you" and the receiver taps on the hyperlinked word 'surprise' which will take the user to the destined page.
Any suggestions as to how this can be done? Examples and samples welcome!
Thanks in advance :)
No, you cannot use html tags in sms / text messages. All you can do is insert the URL without the tag. It then depends on the receivers device whether the URL is presented to the user as link or as plain text.
I experimented with exactly this just yesterday. It seems you can't include a nicely formatted hyperlink, unfortunately. I hope to be proven wrong by somebody else, though :-)
However, as you've probably seen yourself, iPhone is able to recognize an URL and you can tap on it to open the URL in Safari (or tap the disclosure button next the message to get more options on what to do with the URL). As far as I can tell the only thing you can do is format your SMS accordingly: "I have a surprise for you: http://foo.com" even though that might spoil the surprise ;-)
No, you can't do this due to privacy issues. Apple thinks that giving you this ability would allow you to link users to malware and such. Sorry!
i don't think it's possible to create hyperlinks in SMS.
The only way is to send an URL, and the iPhone will convert it to a link...
Use a tiny url from tinyurl.
It doesn't allow you to do exactly what you are wanting but it at least can be used to cover up the long link.
This is the closest thing I figure out to do. I was wanting to use the "
No, you can not do this. However you could use tinyurl and format it like this
http://whateverYouWantToSay#tinyurl.com
Web browsers usually ignore anything before an # therefore you could effectively hide the actual site being linked to, as long as your friend does not know that.
What actually happens is the data before the # is submitted to the web site in the form username:password. However it must be a site that requires authentication to access, or the site will normally just ignore it.
If this helps, I've noticed that a custom hyperlink is possible on the OS X Messages app, but they have to be copied and pasted. To replicate this right click on a hyperlink in your browser and hit copy link. Then paste into Messages.
Uhhh this is possible here is a screenshot of an example - I copied a link from email and pasted in a new SMS - though it appears you cannot type html to create a link....

I want to be able to search an html page that is refreshing every 10 seconds for the word "stat"

I want to be able to search an html page that is refreshing every 10 seconds for the word "stat". If the word is found I then want to alert the user through a pop up dialog and possibly a repeating sound until the user acknowledges it.
UPDATE:
Sorry the question was a bit ambiguous. I do not know a great deal about this stuff I just do it as a hobby.
OK so here is the deal. I work as Biomedical Electronics Technician for a hospital. We have a work order system that is web based. Nurses can enter a work order into this system. I have a browser window open at all times that refreshes periodically through an add-on for IE so I can always be up to date on the status of the work orders coming in. When a nurse the enters enters a work order they have the option of choosing Stat, High, Medium, or Low for the priority. When a stat work order is placed our response time should be within five minutes theoretically. I want some way to alert myself when a stat work order has been placed so I can respond accordingly. And I know a repeating sound would be annoying, but that might be the best way to get my attention.
Another caveat to this is the work order status can be changed by me, the tech. So when a work order is initially placed the status is Not assigned or something like that. Once I go start on a work order I change the status to In Progress. If I have to order a part I change the status to Hold for Parts, etc. So basically, what I am saying is I don't want to alerted if the status is anything but "Not assigned". If it will help I will get a copy of the source of the page when I get to work tomorrow.
Our IT department seems unwilling to help and the company that made the product is so busy chasing the daily bugs that show up to add new features such as this at this time. If I knew more a Google search might help, but alas I am a bit noobish in the programming realm, however I am 2 years from a C.S. degree so I am not a complete novice.
To answer another question, I do not have access to the page I am just viewing it so any sort of script would need to run on my client machine.
Thanks
I found this, try it https://addons.mozilla.org/en-US/firefox/addon/3028/
Maybe it can search for STAT on the entire page?
Based off your description, it doesn't sound like you have access to the server to change the code of the page itself, correct?
If that's the case, spend some time learning how to use Greasemonkey (or rather Greasemonkey for IE). It allows you to add functionality to a web page from the client (browser) side, regardless of what's on the server.
You'll need to find the elements that hold the "stat" term your after, and have it check periodically those elements periodically. Look into the setTimeout method for that periodicity. The rest you'll have to work out specific to that page.
What you're looking for, since you have python available, is to build a simple, easy to use webscraper.
First link is how i would do it quick and dirty.
http://www.ehow.com/how_4436125_read-web-page-using-python.html
Second link is a bit more robust and nifty with BeautifulSoup
http://www.builderau.com.au/program/python/soa/Build-a-basic-Web-scraper-in-Python/0,2000064084,339281476,00.htm
Basically, read the page (even set the whole loop on a 10 second refresh timer).
Go line by line with a while readline loop.
See if one of your magic words exists with a regular expression
...
profit?
(... meaning do your alert song and dance)
(profit being rejoice!)