I am using this script Send Google Form by Email v2.0 (Amit Agarwal) but Google script gives the following message:
"Methode ScriptApp.GetScriptTriggers" has been marked as outdated.
Is there an alternative methode?
Please use getProjectTriggers() instead of getScriptTriggers().
var triggers = ScriptApp.getProjectTriggers();
Related
I'm trying to write my very first Thunderbird extension. If possible, I'd like to only use the newer WebExtensions / MailExtensions APIs.
Two things my extension needs to do:
Performs an action when a new mail arrives and is not junk.
When a message is read, check if there are still unread messages and, if not, performs an action.
The only examples I've found online dealing with "new mail event" hooks look like there are not using the newer APIs. For example:
Components.classes["#mozilla.org/messenger/msgnotificationservice;1"]
.getService(Components.interfaces.nsIMsgFolderNotificationService);
notificationService.addListener(myListener, notificationService.msgAdded);
or
Components.classes['#mozilla.org/messenger/services/session;1']
.getService(Components.interfaces.nsIMsgMailSession)
.AddFolderListener(myListener, Components.interfaces.nsIFolderListener.all);
... where myListener would be called when a new email arrives.
Those codes generate the error Components.classes is undefined in Thunderbird 91. If I understand properly this is because more stuff is required to stay compatible with the legacy API.
My question:
What is the proper way to listen to a new email event, using the WebExtensions / MailExtensions APIs?
Links I did read (but maybe I missed something!):
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Developing_WebExtensions_for_Thunderbird
https://webextension-api.thunderbird.net/en/91/
Oh! I found it!
background.js :
browser.messages.onNewMailReceived.addListener((folder, messages) => {
// ...
});
Those permissions are required: messagesRead and accountsRead.
I have a secure string parameter in data fatory
According to another post this is the way to access said parameter
#{pipeline().parameters.ChassisSqlUsername.value}
This use to and still give a validation error within the dynamic content window:
However the pipeline worked like this without issue. This validation error did not block publishing.
Asof today I can no longer publish if that validation error is present
How do I get around this?
Refer it in this way:
#{pipeline().parameters.ChassisSqlUsername}
It will work.
I don't know why the syntax of ADF is so terrible.
#{json(string(pipeline().parameters.ChassisSqlUsername)).value}
I get my checking account balance emailed to me once per day. I want to use Google Apps Script to pull the balance from the email message and plug it into my checking account spreadsheet. I am a novice to coding, but so far I have figured out how to do the following, which gets me a log of HTML code of the correct email message:
function myFunction() {
var thread = GmailApp.getUserLabelByName("CHK BAL").getThreads(0,1)[0]; // get first thread in inbox
var message = thread.getMessages()[0]; // get first message
Logger.log(message.getBody()); // log contents of the body
}
However, because this method returns the HTML code for the email message and not the actual message text, it doesn't contain the balance number that shows up in the email itself.
I tried substituting getPlainBody in place of getBody, but it returns a null value in the Log.
The question posted here is pretty much my same question (Google script that find text in my gmail and adds it to a spreadsheet?), but even with Mogsdad's reply and helpful links I haven't been able to figure out what's going wrong.
Can anyone help redirect me on how to get the email content instead of the null value?
(Once that's solved, I can't say that the link on Mogsdad's other reply is very clear about how to identify the currency and copy it into the spreadsheet, but of course I haven't been able to play around yet since I can't even access the content yet.)
Thanks!
EDIT 1
See Serge's answer below for instructions on how to parse the HTML. I used those functions to grab the text of the most recent Bank Account Balance email from a Gmail label/filter and drop it into a cell in my spreadsheet.
Then I was able to use the following equation in an adjacent cell to strip it down to just the currency number:
LEFT(RIGHT(A5,LEN(A5)-FIND("$",A5)),FIND(CHAR(10),RIGHT(A5,LEN(A5)-FIND("$",A5)))-1)+0
Of course, this works for me because the currency number is always preceded by $ (the first, and in my case, only $ to appear in the text) and always followed by CHAR(10). Anyone trying to apply this formula would need similar consistency before and after the value they are seeking to isolate.
You could try this code snippet originally written by Corey G on SO to get the text from the html content. I use it quite often and it works nicely most of the time :) (Thanks Corey)
function getTextFromHtml(html) {
return getTextFromNode(Xml.parse(html, true).getElement());
}
function getTextFromNode(x) {
switch(x.toString()) {
case 'XmlText': return x.toXmlString();
case 'XmlElement': return x.getNodes().map(getTextFromNode).join('');
default: return '';
}
}
And a test function to try it :
function test(){
var html = GmailApp.getInboxThreads()[0].getMessages()[0].getBody();
throw(getTextFromHtml(html));
}
As to why getPlainBody() is returning null, it is most likely due to a bug in Google Apps Script. The issue has been filed at https://code.google.com/p/google-apps-script-issues/issues/detail?id=3980.
From that thread: "It seems the messages affected contain HTML in their content. A possible workaround involves using getBody() instead of getPlainBody() and parsing through the HTML directly."
I am having a issue where I am trying to retrieve the email of the user who is logged in using Buddypress. Here is my code:
global $bp;
echo bp_core_get_user_email($bp->loggedin_user->id);
Here is the error message that pops up when I open the php page:
"Fatal error: Call to undefined function bp_core_get_user_email() in /home/user/public_html/useremail.php on line 4"
Have you loaded WordPress & BuddyPress in your file useremail.php?
I see that it's the same level as wp-config.php. To make it know anything about WP/BP functions you need to do at least this:
include ('./wp-load.php');
Otherwise in your situation that php file will through errors everytime you will use non-standard php functions.
But the true way is to use WP - create:
1) a plugin that will handle all requests to a specific url
OR
2) create a page in WP dahsboard with a specific page template, and in its template file you can write whatever code you need or want.
Other option to get the email:
$user_active = wp_get_current_user();
$user_mail = $user_active->user_email;
What I would like to do is the following:
var handler1 app.createClientHandler().
forTargets(textbox2).setText(textbox1.getText());
However .getText doesn't exist on the client side.
I can get it to work using ServerHandler and e.parameter.textbox1:
v3.setText(e.parameter.textbox1);
Are there other solutions or workarounds?
No, it's not possible to read the values of widgets in a client handler.