I'm trying to write a script selects the first email if less than an hour and grabs the email, and then auto selects the next email if less than an hour and grabs the email till the email is greater than the hour.
I can grab the first email, but getting the second one is what I can't think on how to do.
Direction is what I'm looking for, instead of just the answer, I just need to where to start.
tell application "Mail"
set theMessage to message 1 of mailbox "INBOX" of account "Google"
set theDate to date received of theMessage
if theDate is less than the (current date) and (theDate) is greater than ((current date) - (1 * hours)) then
set theEmail to the (address of to recipient of theMessage)
end if
end tell
Try enclosing your code inside of a repeat loop:
repeat with oneMessage in every message of mailbox "INBOX" of account "Google"
set theDate to date received of theMessage
--Conditional analysis
end repeat
The main problem with this code is the possibility of have a HUGE number of messages in your INBOX, thereby bogging down the script.
Another alternative is to just grab all the messages less than an hour old in a single command, and then deal with the resulting list:
set oneHourMessages to every message of mailbox "INBOX" of account "Google" whose date received is less than the (current date) and date received is greater than ((current date) - (1 * hours))
Good luck,
Related
Is there a way to make a table trigger that sends an email once a date attribute get 30 days from the date listed? e.g. 07/31/2020 is listed in the table and when it gets to 07/01/2020 in real life, an email is sent out to notify someone. it would be a 30 day in advance notification.
Thanks
You can make an SQL Job, which will executed on daily basis and send db email once it get date difference (datediff(D, getdate(),'2020-07-31) equals to 30 OR change in the table to trigger
It's a number of years since I have used Access and I'm creating an asset database using Access 2016 and need to send an automated email with a report that will show assets that are due to be refreshed in the next year, six months, 3 months, then 2 months then 1 month. The report does have a date field called refresh date.
I have see details on how to send an email from access but I cannot find how to automatically run the report and for it to search by the date field?
Any help would be appreciated
Thanks
One solution would be to launch your access application from the Task Scheduler. That way you can setup in detail when to launch the application. Then within the application you can produce the report based on the current date.
You need to:
-Setup Task Scheduler to launch the application at the desired times.
-Set macro Autorun to launch a VBA script.
-The VBA script checks if the given conditions are true. If so it produces the report, exports it as a PDF file and makes the email with the file file.
Please specify your question more in case you need further help on "and for it to search by the date field?".
You could set a timer on the form that checks if Now() = date on the form + X number of days (30, 60, 90, 180, 365) and if it hits one of them it sends the appropriate email.
If the DB is open all the time have it run once a day (timer interval of 86400000 ms).
If it is going to be open but not all the time have the interval set to a lower amount.
Date picker used in our application has 2 dropdowns in it (list of months and years) in UI. Manual input is disabled for some reason and hence it's getting difficult for us to handle it in jmeter.
Scenario is:
User will select Year first > then month > then date in FROM dropdown and TO dropdown will contain any date (select Year first>then month> then date) which is greater than date selected in FROM but wil be less or equal to today's date.
How can I achieve the same on jmeter? thanks in advance.
Usually, the date value is being send to the server in one parameter, or in three, for example
date = "12/01/2019"
day = 01
month = 12
year = 2019
You need to record your scenario of choosing and submiting a date by using the HTTP(S) Test Script Recorder and to see how it sends in the request.
How can I start charging a user the user immediately for a PayPal billing agreement?
Here's what I've got so far.
Create a Billing Plan (POST .../payments/billing-plans/)
Make it active (PATCH .../payments/billing-plans/)
Create a Billing Aggreement (POST .../payments/billing-agreements/)
Send user to approval_url, user approves, redirected to return url
Execute agreement (POST .../payments/billing-agreements//agreement-execute)
This all seems to work, but I want to charge the user right now and every month in the future. If I set start_date to now in step 3 I get an error, it must be in the future. If I set it in the future the user is not charged.
Do I need to 'Set outstanding agreement amounts' then 'Bill outstanding agreement amounts' for the initial payment?
Also, what about monthly payments, do they require some action or do they just happen as specified in the Billing Plan?
Update
I'm testing this around 2014-09-16T20:06:30+0000
If I send start_date as the current UTC time it get an error at step 2 telling me it must be in the future.
If I send the current date +30 secs or +2 hours I get through to step 5 which returns a 400 response: UNKNOWN_ERROR "An unknown error has occurred"
If I send the current date +4 hours it all works. The current UTC time is 8pm so adding 4 hours means the start_date is tomorrow.
Does this mean I can't charge the user today? Does the start_date have to be in next day or even the next business day?
I've talked to a PayPal rep and found that start_date must be tomorrow or later. They are going to add this to the docs.
If you want to start monthly billing immediately you might be able to do it by setting the start date to be in one months time and charging a setup fee to cover the first month. I haven't tested this as it's not what I want.
First payment for agreements will be billed right on specified start_date. The subsequent amounts are also taken automatically by PP. You need to work with the BillOutstandingAmount calls only if PP failed to pick the payment on the renewal date.
The problem I faced when developing with their RestAPI was specifying a wrong timezone. Maybe this is the same for you. Make sure the proper timezone is specified in your start_date (with all dates given to PP in fact)
Dates should be in this format: yyyy-MM-ddTHH:mm:ssZ
ex. start_date = 2014-09-16T09:20:00-0400
IF you want to make sure Paypal accepts the date as being valid, just add a few seconds to it.
Let's say you are in Java, you can do something like:
private String getPaypalDate()
{
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
// Add 30 seconds to make sure Paypal accept the agreement date
Date rightNow = new Date(new Date().getTime() + 30000);
return df.format(rightNow);
}
I used this date format working.
$time = time();
$startDate = date('Y-m-d\\TH:i:s\\Z', $time);
I can't replicate, actually. I stumbled on this thread when getting the error due to setting it to moment.now(). But setting it to even 5 seconds in the future works a-ok. I'm using JavaScript, "start_date": moment().add({seconds:5}).format() and that checks out fine. Moment.js will set TZ to UTC when formatting as such, so it's gotta be a timezone thing on your end?
It looks like the payments just process based on the date being before or after 07:00 UTC of the current date.
For example. The current date time is 2017-05-04T04:50:00.00Z I set my start date to be the current UTC date time plus 30 seconds. Because the agreement date is set to a value greater then the current date time the API doesn't throw an error, but it DOESN'T set your time to be what you specified. Instead it sets it to 2017-05-04T07:00:00Z.
Now, if you have the same date time of 2017-05-04T04:50:00.00Z and instead of adding 30 seconds you add 24hrs you'd think that your time would then be set to be 2017-05-05T04:50:00.00Z. But no, the time will be set to 2017-05-05T07:00:00Z.
So it seems like these just process everyday at 07:00 UTC and you can't specify anything but the date.
Is there anyway to obtain an account's info including account's balance at a point of time? Basically, I need to get the account's balance at the beginning of month and end of month for accounting purposes. However, a cron job to update account's info at the beginning/end of month may fail for various reasons, in which case there is no way to retrieve account's balance at beginning/end of month anymore!
We do not have a mechanism to capture the value at a specific time as you are asking but provide a balance each time you capture the transactions. If you capture a day later you can always perform a reverse running balance using the current balance - the transactions that occured between the data you wish to display.
Example:
August 1st:
$5.00 Transaction to McDonalds
$3.00 Transaction to Ralphs
Balance on August 2nd:
$35.00
Calculate Balance for the 1st.
$35 + 5 + 3= $43.00 balance at start of month.
You add the debits and subtract the credits and you can obtain the value you are seeking.