Create Gmail Email

From $1

There is a firefox button next to the patient's email in R211B25 and higher.  This generates the following page, at http://127.0.0.1:8001/create-web-email.html

 

Create web email...

You need to write a chickenfoot script and trigger it on this page to run your custom searches. This also requires Firefox.
Email: Demo Patient <demopatient@paradise.net.ur>
Name: Dr Graham Chiu
Speciality: Physician/Rheumatologist
Line1: 12 Shirley Street
Line2: Karori
City: Wellington 6012
Comms: phone: 04 939-0216 fax: 04 939-9088
Phone: 04 939-0216
Fax: 04 939-9088

This provides us with all the information we need to send a new email to this patient, and to construct a custom signature.

In this following example, we are going to use Gmail.  We don't need to enter a login userid and password as most of the time Gmail will save these for us and allow us to login automatically.

// 22 October 2007
// Graham Chiu, Chen-Hsiang Yu

try { email = find(/Email: (.*)/).groups[1]; }
catch(e) {
	email = '';  // this is two single quotes
}

try { myname = find(/Myname: (.*)/).groups[1]; }
catch(e) {
	myname = '';  // this is two single quotes
}

try { specialty = find(/Specialty: (.*)/).groups[1]; }
catch(e) {
	specialty = '';  // this is two single quotes
}

try { line1 = find(/Line1: (.*)/).groups[1]; }
catch(e) {
	line1 = '';  // this is two single quotes
}

try { line2 = find(/Line2: (.*)/).groups[1]; }
catch(e) {
	line2= '';  // this is two single quotes
}

try { city = find(/City: (.*)/).groups[1]; }
catch(e) {
	city = '';  // this is two single quotes
}

try { comms = find(/Comms: (.*)/).groups[1]; }
catch(e) {
	comms= '';  // this is two single quotes
}

var signature = ('\n\n\n---\n' + myname + ' ' + specialty + '\n' + line1 + ', ' + line2 +', ' + city +'\n' + comms);

go("https://mail.google.com/mail/");

// Please enter your username and password
// enter('username','XXXXXXX');
// enter('password','XXXXXXX');
// click('sign in');

// For click the 'Compose Mail' link
setTimeout(
function (){
   m = find('Compose Mail');
   click(m.element);
   //whenLoaded() is used to make sure the page is loaded completely
   whenLoaded(fillmail);
}, 5000);

// When 'Compose Mail' page is loaded, fillmail() is called to enter data
function fillmail(){
  enter("To:", email);
  enter("sixth textbox",signature);
};

Discussion

What this script does is that it pulls all the data off the custom web page (create-web-email.html) created by Synapse needed to send the new email and to construct the signature.  It then navigates to gmail's secure home page, and waits until the "Compose Mail" link appears.  It then clicks on this, and then waits again until the "To:" link appears.  It then fills in the email address field and inserts a new signature. 

Acknowledgements

I wish to thank Chen-Hsiang Yu from the chickenfoot mailing list for the two wait functions in this script that allow us to process the asynchronous javascript used by Gmail's interface.

Tags:
 
Images (0)
 
Comments (0)
You must login to post a comment.