How to send a message using iChat and AppleScript - scripting

I have a need to send a message to a number of people to let them know when an event is occurring. It is always the same list of people, and always the same event, so I would like to script it.
The problem that I have is that I know that I need to use the send command to send the message. And the format of that command is
tell application iChat to send "message" to _buddy_
The problem is how to get that buddy. I know how to get the list of all buddies, and to loop over them:
tell application "iChat"
repeat with myBuddy in buddies
end repeat
end tell
What I can't seem to find is how to just get the buddies that I care about, for example those with name "Pietje Piet" and "Joe Anonymous", and then just to send messages to these two contacts.

You'll have to aquire a list of the buddies you care about in a separate list somehow. Here's a suggestion:
set peopleICareAbout to {"Pietje Piet", "Joe Anonymous"}
tell application "iChat"
repeat with myBuddy in buddies
--get properties of myBuddy
if full name of myBuddy is in peopleICareAbout then
send "dfgdgdf gdg dfg dfg" to myBuddy
end if
end repeat
end tell

Related

URN Filter to Ignore Emails

I am using UiPath's Get Outlook Mail Messages component to obtain emails.
My only request has been to ignore any emails that are Replies, so contain "RE:"
In my email filters I had tried the below:
#SQL=urn:schemas:httpmail:subject NOT LIKE 'RE%'
Unfortunately, I receive the error "Get Outlook Mail Messages: Cannot parse condition. Error at "#SQL=((urn:schemas:httpmail:subject NOT ...".
When I try the filter: `
#SQL=urn:schemas:httpmail:subject LIKE 'RE%'
I am able to obtain all emails that contain 'RE:' but as specified, I want to omit these.
Would anyone be able to advise how to Omit these emails? I need to obtain every other email in the Inbox so makes more sense to just ignore the Replies.
Thanks,
Your code is very close to being correct. The NOT keyword does work, just the placement is incorrect, unlike normal SQL where the NOT would be before the LIKE, in this case it would come before the field name.
So rather than:
#SQL=urn:schemas:httpmail:subject NOT LIKE 'RE%'
It would be:
#SQL=NOT urn:schemas:httpmail:subject LIKE 'RE%'

Slack API - Don't notify user when parsing user id

In this message formatting doc: https://api.slack.com/docs/message-formatting, you can use special control sequence characters < and > to perform server-side parsing (server-side as in Slack API's server-side).
So using <#U024BE7LH> in your chat.postMessage() call will get parsed to something like #bob or whatever the username associated with that ID is, in the actual text that shows up in slack.
Unfortunately, this will cause a notification for the person you're referring to. How do I make it so that it doesn't notify the person? I've tried to enclose in a code block, i.e.:
`<#U024BE7LH>`
or
```
<#U024BE7LH>
```
But it still pings. I'm thinking the only way is to get a list of users and parse the name from the ID.
According to this, backticks should work but empirically it hasn't for me. The Slack employee says to just convert the user ID to their name and use that without the templating.
https://forums.slackcommunity.com/s/question/0D73a000005n0OXCAY/detail?language=en_US&fromEmail=1&s1oid=00Dj0000001q028&s1nid=0DB3a000000fxl3&s1uid=0053a00000Ry9cX&s1ext=0&emkind=chatterCommentNotification&emtm=1667894666436&emvtk=fH.W2M01lq9W1cf31RSROPwB7LYs.och8RgbVTqoNlg%3D&t=1667931570045

How to get maximum number of tweets on an user

i have this code
("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser.'&count=500'
But it is giving me only 200 records , I found in twitter document that it will give 3200 tweets.Is i am doing wrong what should i do to get that much tweet.
Since there is no page system in twitter 's API, to go throught timelines, you must use the "max_id" parameter.
Here is an helpful link that explains how to work with timelines with nice illustrations: https://dev.twitter.com/rest/public/timelines.
Edit: here is how you do it.
"To use max_id correctly, an application’s first request to a timeline endpoint should only specify a count."
Make your request "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser.'&count=500 (you can put 200).
Then when you get all your data, " keep track of the lowest ID received" and use it as parameter (the same way you do for the count) for your next request. it will give you the 200 next posts with a lower id than the one you specified. Do it again until you reach the end.

Extract single messages from gmail thread (Objective-c)

I am trying to fetch gmail emails with IMAP (in objective-c), and I want to separate, for every thread, every single message that has been sent in the conversation. To make myself more clear, imagine a conversation like this one:
John says : Hi Mike, that's the first email
Mike replies : Hey John, how are you ?
John replies : Great Mike, thanks.
If I get John's emails through IMAP, I will fetch only one email, that will be :
Hey John, how are you ?
On Wed, 21 May,
Hi Mike, that's the first email
And I would like to get two different messages out of this one email I fetched.
First message would be "Hi Mike, that's the first email"
Second message would be "Hey John, how are you ?"
I looked at the message-id field in the header, but I can't figure out how to link that back to actual messages.
Any ideas?
Thanks !
[EDIT] : So far I can parse the email in John's inbox and extract the associated string containing the message. But what I want is the actual message (with the header and all), not just the string containing the message.
Gmail has a very nice IMAP extension to do this. I've never tried to use the objective-c libraries, though.
If you want to do this for one conversation, you need a message to start with. Any message in the conversation will do. First, you retrieve the X-GM-THRID of that message: a uid fetch 23451345 x-gm-thrid, which gives you a 64-bit number, perhaps 9876543876543444423. Next, you look for the other messages in the same conversation: b uid search x-gm-thrid 9876543876543444423, which gives you the UIDs of all messages in that conversation, and you're done.
If you want to do it for all the conversations in the inbox, you issue c uid fetch 1:* x-gm-thrid, which gives you a set of message-conversation tuples: "message 123 belongs to conversation 9876543876543".
If you want to order the messages within each conversation, the easiest way is probably to retrieve the internaldate item and sort by that. Gmail also has an x-gm-msgid but I haven't looked to see whether it's useful for sorting.

What are the Aweber API Variables $account_id and $list_id?

You can check here:
https://labs.aweber.com/docs/code_samples/subs/create
The script to add a new subscriber to the list via api requires those two pieces info...only I cannot figure out for the life of me what those two variables are!! I've beaten through every little aspect of my Aweber Subscriber Account, AND my Aweber Labs account...and I can't find any reference to either of those variables anywhere. I've submitted some tickets to them, and haven't gotten any response yet.
Does anyone have any ideas here? I've tried my account names, my list names, to no avail!
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Okay, I've got it! You can get the values of both of these variables by dumping some other variables in the aweber api after making certain api calls.
get the account id first:
$account = $aweber->getAccount($accessKey, $accessSecret);
then vardump or print_r $account.
next we get the list id:
$account = $aweber->getAccount($accessKey, $accessSecret);
$list_url = 'https://api.aweber.com/1.0/accounts/<id>/lists';
$lists = $account->loadFromUrl($list_url);
then vardump or print_r $lists.
And you are all set! I'm so happy I figured this out, it freakin took long enough. Hopefully this saves some one a bit of time.
I too have agonized over finding the $list_ID, so went to deactivate the list, and create a new one, and "discovered" that if you hover over the Deactivate button, you get a url you can copy, and this gives both %account and %list Ids
https://www.aweber.com/users/lists/deactivate/$accountID/$lisID
like this....
https://www.aweber.com/users/lists/deactivate/123456/123456
Hopefully this will help make someone as it is a super easy solution
The proper answer is Anne Allen's one, but...
Check the return of the /accounts endpoint. It should return the same account id as you detected in the link, but I had cases they were different (strange, isn't it?). Use the account id returned by the /accounts endpoint and other endpoints to retrieve lists, subscribers, etc. will start to work. It's like if some accounts have two ids, one partially works and the other fully works.
Let me tell you how to get $list_id value... login into your AWeber account and then create a new list copy only integer value from list's name.
At first, login.
1) click Reports>Settings. Your account ID will be displayed in the box,example: ?id=XXXXX
2) click List Options>List Settings. There you will see the list ID under the name.
p.s. To add subscriber, you can use this - Automatically add into aweber list