I want to be able to search a mailbox in apple's mail.app for a phase or word, then somehow return or copy all of the email addresses from which the emails which have successfully returned from the result of the search have been sent from.. if you get what i mean
I thought that the only way to do this is probably applescript but if anyone else knows any other way please tell me :)
Mail.app doesn't allow searches directly via Applescript but this will do the trick, though it is a bit slow because it has to iterate through each message:
global searchTerm
property emailList : {}
set searchTerm to "aSearchTerm"
tell application "Mail"
set theInbox to inbox
set firstMessage to 1
set lastMessage to (get count of messages in theInbox)
repeat with thisMessage from firstMessage to lastMessage
set currentMessage to message thisMessage of theInbox
set messageContent to content of currentMessage
if messageContent contains searchTerm then
set end of emailList to sender of currentMessage
end if
end repeat
end tell
return emailList
you could also invoke a real search in the interface and then collect the items
[Applications launch:#"Mail"];
[Keyboard command_alt_press:'f'];
[Keyboard paste:term];
+(void) command_alt_press:(char)c{
[self runScript:[NSString stringWithFormat:#"tell application \"System Events\" to keystroke \"%c\" using command option down",c]];
}
you seem competent enough to complete the rest of the code.
Related
It appears that through the alert() function you can code a message to be sent, but what about the webhook?
I would like to use capitalise.ai, and they require to set in the alert both a webhook (https://tvwebhook.capitalise.ai) and a message, for example {"alertId": "b2f0d9f2-a848-48e4-8218-70350b24xxxx"} which will trigger a specific action, for example to buy or to sell.
Fact is, if I set in the UI an alert for a strategy I have created in Tradingview, there will be only one alert for all the possible events, and therefore only one message, but then how can I tell Capitalise.ai if the alert is for selling or buying?
I could do something like
if enterLong
alert("message 1))
else if enterShort
alert("message2"))
But then where do I put the webhook?
Thank you
You need different messages for different orders.
Check out this tutorial.
Your code must include something like this :
alert(jsondata, alert.freq_once_per_bar)
with jsondata a string in the json format.
Then your jsondata (your message) will be sent to your webhook.
To create the weebhook, look in the Alert Menu from your Tradingview Chart :
Choose the nae of your strategy in the Condition (Bybit Bot in the screenshot),
and create a 'Open-ended alert' alert :
Then go on the notification menu to give the url for the webhook :
I do something like this with a discord alert. Create your message in the script and not in the message box on the alert fly out.
I use this in a library
export GetDiscordJson(string userName, string avatar_url, string content, string title, string url, string description, string _fields, string _footer, string _authObject, string clr) =>
//parameters with _ lead are already formatted for the json end object
_username = jsonKeyValuePair("username", userName)
_avatarUrl = jsonKeyValuePair("avatar_url", avatar_url)
_content = jsonKeyValuePair("content", content)
_title = jsonKeyValuePair("title", title) // title = ticker
_url = jsonKeyValuePair("url", url)
_description = jsonKeyValuePair("description", description)
_color = jsonKeyValuePair("color", clr)
_embeds = str.format("\"embeds\":[{0}\n{1},\n{2},\n{3},\n{4},\n{5},\n{6},\n{7}\n{8}]", "{", _authObject, _title, _url, _description, _color, _fields, _footer, "}")
str.format("{0}\n{1},\n{2},\n{3},\n{4}\n{5}", "{",_username, _avatarUrl, _content, _embeds, "}")
Then in the indicator call it on each kind of alert
if enterLong
content = w.GetDiscordJson(_botName, _avatarURL, contMessage, syminfo.ticker, _titleURL, chartTimeframe, _fields, _footerObject, _authObject, _color )
alert(content, alert.freq_once_per_bar)
Simply put the webhook json string you get from capitalise into the alert(Capitalise-string,alert-frequency) command in your script. and then you can based on condition in your script decide which capitalise string to send. The alarm setup can only be done once with just the capitalise webhook URL, and leaving the message box empty.
Hope that’s understandable 😀
I have a very bland messagebox asking my users a simple question (not yes or no). For quick development I used a simple System.Windows.Forms.MessageBox and worded the question ("If you want to choose 'A' click 'Yes' if you want to choose 'B' click 'No'"). Now I'm going back and improving the look and feel of my wpf application and I'm stuck trying to convert this MessageBox into something that looks good.
My preliminary search told me to use Xceed.Wpf.Toolkit.MessageBox to be able to create custom message box but I'm getting an exception when I'm trying to use it.
Old Code
DialogResult dialogResultForDataDisplay = System.Windows.Forms.MessageBox.Show("Yes: Display by properties \n \t Each row will contain data for a specific asset class in a specific submarket during a specific quarter. \n \n No: Display by quarters \n \t Each row will will show the change over time for a specific property of an asset class in a specific submarket.", "Data Grouping Format", MessageBoxButtons.YesNo);
New Code
Style style = new Style();
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, "By Property"));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, "By Quarter"));
MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show("How do you want your information displayed?", "My caption", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, style);
Console.WriteLine(result);
The new code is generating this exception: System.InvalidOperationException: 'The calling thread must be STA, because many UI components require this.'
How would you go about handling this exception?
One solution I found now is rapping it in an invoke method. If someone has a better solution please post.
MessageBoxResult result = MessageBoxResult.None;
System.Windows.Application.Current.Dispatcher.Invoke((Action)delegate
{
Style style = new Style();
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.YesButtonContentProperty, "Yes, FTW!"));
style.Setters.Add(new Setter(Xceed.Wpf.Toolkit.MessageBox.NoButtonContentProperty, "Omg, no"));
result = Xceed.Wpf.Toolkit.MessageBox.Show("How do you want your information displayed?", "My caption", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.Yes, style);
}
Console.WriteLine(result);
I'm a bit new to ExactTarget in general so I apologize if this has already been answered (if it has, I can't find it anywhere).
I am attempting to create an email which will conditionally display n of 50 bulleted lists containing links to product information. However, whenever I attempt to send this email, I receive the following error message:
Other errors found in the email.
Category: AMP Script
Functions and Custom Objects:('
Field Name %%F50%% was not found in the send source.
Category: AMP Script
The second paragraph of the error message is repeated 50 times total (one for each field).
I cannot seem to figure-out why this issue is occurring:
I have a Data Extension with data for each field mapped in it.
I have imported valid data from a CSV to the data extension.
I have a list of valid subscribers to whom I am attempting to distribute.
I have an email template with custom areas inside each of which check if the subscriber has a "true" value for each field and shows/hides the content snippets on that basis.
I have 50x content snippets (one for each field).
There has to be something I'm missing here. Any ideas?
Thanks!
If the 50 fields are not in your sending data extension, you'll need to retrieve them with a script something like this. Note the values are displayed with%%=v(#DEColumn1)=%%:
%%[
var #rows, #row, #rowCount, #numRowsToReturn, #lookupValue, #i
set #lookupValue = "whee"
set #numRowsToReturn = 0 /* 0 means all */
set #rows = LookupOrderedRows("DataExtensionName",#numRowsToReturn,"DEColumn1 desc, DEColumn2 asc","LookupColumn", #lookupValue)
set #rowCount = rowcount(#rows)
if #rowCount > 0 then
for #i = 1 to #rowCount do
var #DEColumn1, #DEColumn2
set #row = row(#rows,#i) /*get row based on loop counter */
set #DEColumn1 = field(#row,"DEColumn1")
set #DEColumn2 = field(#row,"DEColumn2")
]%%
Row %%=v(#i)=%%, DEColumn1 is %%=v(#DEColumn1)=%%, DEColumn2 is %%=v(#DEColumn2)=%%
%%[ next #i ]%%
%%[ else ]%%
No rows found
%%[ endif ]%%
Also, there are a lot more people answering SFMC questions over at salesforce.stackexchange.com -- mostly tagged with marketing-cloud, ampscript.
I retrieve names from a group using formula, and put them in a field of type Names this way:
#Name([CN];NAME)
I want to manipulate this data in my code, but using Lotusscript. Can't find it at Google or Lotus Domino's Help. Is there a way I can handle this?
In LotusScript there is a class named "NotesName" to do such manipulations.
If there is a field named "NAME" in you document, then the code would look like:
Dim doc as NotesDocument
Dim nnName as NotesName
'Somehow get the document, using ws.CurrentDocument.document
'or db.UnprocessedDocments.GetFirstDocument, depends on your situation
Set nnName = New NotesName( doc.GetItemValue("NAME")(0) )
Whatyourlookingfor = nnName.Common
If NAME is a Multivalue then you would have to write a loop to get the common- name for every element in the array doc.GetItemValue("NAME")
The next time you have a question, check out the language cross reference in the help...
There it tells you, what the LotusScript- Pendant for #Name is.
Please try with below suggestion for getting list of person names from group.
First need to check the availability of searching group on names.nsf (All the groups are available on "($VIMGroups)" view.
if the group is available means you need to get the list of values from "Members" item
The members item have variant(list) values. So need to iterate the members for getting each value
Please refer the below sample code:
Set namesDb=session.GetDatabase(db.Server,"names.nsf")
Set groupVw=namesDb.GetView("($VIMGroups)")
Set groupDoc=groupvw.GetDocumentByKey("groupname")
persons= groupDoc.members
Forall person In persons
Msgbox person
End Forall
You can use the Evaluate method. It will return you the result of a Notes Formula:
Dim result as Variant
formula$ = "#Name([CN];NAME)"
result = Evaluate(formula$)
If the formula needs to be evaluated within the context of a document, you can pass that document as a second parameter to the method.
More info here
I have a mail-in database application and I am finding that occasionally an email is received with an attachment that is not part of the Body field and therefor not able to be "seen" by rtItem.EmbeddedObjects.
How do I identify that there is an attachment if it is not in the Body and once I do that how do I get a handle on it?
I need to determine the type of attachment (PDF, JPG, DOC, XLS, etc.), detach it and then process it based on the extension.
Here is the various If statements that do all the checking of the Body (RTF) field and the associated EmbeddedObjects. This does not catch an attachment that is "outside" of the Body.
Set rtItem = mailDoc.Getfirstitem("Body")
If ( rtItem.Type = RICHTEXT ) Then
If Not (IsEmpty(rtItem.EmbeddedObjects)) Then
ForAll o In rtItem.EmbeddedObjects
If (o.Type = EMBED_ATTACHMENT) Then
noAttachment = True
Else
noAttachment = True
End If
End ForAll
Else
noAttachment = True
End if
Else
noRTF = True
End If
I also have a document with nothing in the Body but $File contains the attachment name. How do you find that?
Youll need to get at those attachments using the EmbeddedObjects property of the NotesDocument. The union of that property plus all the EmbeddedObjects properties of all rich text items gives you access to all the attachments. Note that usually you only need to worry about the Body rich text item.
FYI we've hit a similar problem when the mail server was running out of disk space, or if a virus scanner blocked access to the attachment