I am writing an applescript which works as an email merge that takes information from a Numbers document (name, email address, license codes, promo codes) and generates an email in Mail. After inserting the base & dynamic content, some text formatting occurs (making text bold and red or blue). The code works, but the message signature disappears once some of the content is edited. The signature is there but it disappears seconds later.
However, if I set a breakpoint (using Script Debugger) on the line the message signature is set, it works just fine. Below is a sample code which illustrates the point:
tell application "Mail"
set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false})
tell theMsg
make new to recipient with properties {name:"Josh Booth", address:"none#none.com"}
set character 1 to "Y"
set color of character 1 to {60000, 1, 1}
end tell
set theMsg's message signature to signature "JB_SocialMedia"
log "Fin"
end tell
Additionally, even though the property visible is set to false, it shows up anyway. Running on OS X Yosemite, but this issue has also happened in Mavericks.
Any thoughts?
Create the signature with the message.
tell application "Mail"
set theMsg to (make new outgoing message with properties {subject:"Test", content:"Wahoo", visible:false, message signature:signature "JB_SocialMedia"})
tell theMsg
make new to recipient with properties {name:"Josh Booth", address:"none#none.com"}
set character 1 to "Y"
set color of character 1 to {60000, 1, 1}
end tell
log "Fin"
end tell
Related
When I tried to delete Document 1's headers.
tell application "Microsoft Word"
set headers to get story range document 1 story type primary header story
delete headers
end tell
I got a problem "Microsoft Word got an error: Can’t get document "Document1"." number -1728 from document "Document1"
Why?
I open a document, and set a header.So the document 1 exist.When I tried this code.
tell application "Microsoft Word"
set headers to get story range document 1 story type primary header story
get content of headers
end tell
It's all right.And get the header's text content.
I think, you should avoid creating variable headers, which is reserved word (property). Test following snippet yourself, because I don't use Microsoft Word at all.
tell application "Microsoft Word"
tell (story range document 1 story type primary header story)
delete its headers
end tell
end tell
Want to Select Multiple messages in Mail.app, then
1.move them to a folder "AdvertRule"
2.Add Condition (sender's email address) to existing rule "TestRule 23"
Results from Code
works perfectly
Partial, wud add condition to the rule, x times if x number of messages selected, and all emails addresses in same condition as in ( a#aa.com b#bb.com c#cc.com)
Wondering if can be helped to get 1 email address for each condition in the Rule
even better if has error correction (wud not form a new Condition if it already exists)
Tx in advance
(*
Based on
https://apple.stackexchange.com/questions/149008/in-mail-app-get-list-of-recipients-for-just-one-of-the-many-email-accounts
https://discussions.apple.com/thread/7319379
Move selected Messages to another Folder
*)
tell application "Mail"
set theSenderList to {}
set target_account to "Exchange"
set target_mailbox to "AdvertRule"
set theMessages to the selected messages of message viewer 0
repeat with aMessage in theMessages
set end of theSenderList to (extract address from sender of aMessage)
set oldDelimits to AppleScript's text item delimiters
set AppleScript's text item delimiters to " "
set theSender to (theSenderList as string)
set AppleScript's text item delimiters to oldDelimits
end repeat
set r to rule "TestRule 23"
set s to selection
if s is not "" then
repeat with currentMessage in s
move currentMessage to (first mailbox whose name is target_mailbox) of account target_account
tell r
make new rule condition at end of rule conditions with properties {expression:theSender, qualifier:does contain value, rule type:from header}
end tell
end repeat
end if
end tell
Hey after reading thru the applescript for beginners
After getting Sender List, then add rule with every sender in the sender list, then with every message in selection, move the message
That shud work
I am trying to run a very simple script in automator for a the apple program numbers. I have tried a couple of different scripts with no success.
With the following code:
on run {input, parameters}
tell application "Numbers"
activate
tell document 1 to tell sheet 1 to set the value of cell "B3" to 0
tell document 1 to tell sheet 1 to set the value of cell "C4" to 42
end tell
return input
end run
I get the following error message:
"Numbers got an error: Can’t set cell "B3" of sheet 1 of document 1 to 0."
There was a nearly identical posted question with the following solution:
on run {input, parameters}
tell application "Numbers"
tell table 1 of sheet 3 of document 1
set the value of cell 1 of column "E" to 1000
end tell
end tell
return input
end run
but this gives me the following error message:
"Numbers got an error: Can’t set table 1 of document 1 to 1000."
This other post did mention it may have something to do with privileges but did not elaborate and I have been unable to find any more information regarding this.
Can anyone help me please?
Thank you.
With a Numbers document already opened, the following example AppleScript code works for me:
tell application "Numbers"
activate
tell first table of first sheet of front document
set value of cell "B3" to 0
set value of cell "C4" to 42
end tell
end tell
Here is a different way of saying the same thing as the example AppleScript code above:
tell application "Numbers"
activate
set value of cell "B3" of table 1 of sheet 1 of document 1 to 0
set value of cell "C4" of table 1 of sheet 1 of document 1 to 42
end tell
Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors. Additionally, the use of the delay command may be necessary between events where appropriate, e.g. delay 0.5, with the value of the delay set appropriately.
VB6 will REPORT a LEFT location greater than max integer when the form is in an auxiliary screen. However, I cannot assign that value as a LEFT specification.
I manually drag frmSecondary to the secondary monitor (located to the right of my primary monitor).
I click a button within frmSecondary in order to write the value of frmSeconday.Left to a file. It writes 49950.
I close the program, then re-open.
I read the value from the file (and the value IS 49950).
I try to programmatically assign that value to frmSecondary.Left
Failure (works OK if the value is less than "largest integer").
Expected result: I should be able to assign the value that was written to file. Better yet, any ideas of how to programmatically place frmSecondary at it's "proper" location on the secondary monitor?
I simply read the value from file:
Input #fnum, frmSecondary.left
I've tried, without success:
Dim lft as variant
Input #fnum, lft
frmSecondary.left = lft
I have confirmed that the value being read from file is, in fact, 49950. I do this confirmation two ways...one is by looking at the file; the second is by putting a "stop" in the program and showing the value of lft.
TOTAL NONSENSE
Ignore this entire post. I just discovered my error -- it's so embarrassing, I don't even want to describe it. Nothing quite like spending an entire afternoon (to say nothing of YOUR time) chasing garbage.
If I try to replace or cancel an order I get a message
58=Conditionally Required Field Missing
and the next message contains
58=Invalid MsgType
Here are the logs:
Replacing an order (tgFZctx200U61 is my side. FG is an exchange.):
20170203-15:44:04.225 : 8=FIX.4.49=15135=G34=349=tgFZctx200U6152=20170203-15:44:04.22556=FG1=U6111=270071221=138=240=241=2700744=11640054=155=RTS-3.1760=20170203-18:44:04.20510=028
20170203-15:44:04.225 : 8=FIX.4.49=23235=849=FG56=tgFZctx200U6134=352=20170203-15:43:56.98137=572984433198=F:572984433526=$01$11=270071241=2700717=exec-201702031001027616150=E39=E55=RTS-3.17461=FXXXXX54=138=140=2151=114=06=060=19700101-00:00:00.00010=213
20170203-15:44:04.275 : 8=FIX.4.49=11535=j34=449=tgFZctx200U6152=20170203-15:44:04.27556=FG45=358=Conditionally Required Field Missing372=8380=510=065
20170203-15:44:04.275 : 8=FIX.4.49=33335=849=FG56=tgFZctx200U6134=452=20170203-15:43:56.98237=572984753198=F:572984753526=$01$11=270071241=27007453=1448=tgFZctx200U61447=C452=317=3355471052150=539=01=FZ00U6155=RTS-3.1754=138=240=244=116400.00000336=9291151=214=06=060=20170203-15:43:56.98920008=-922337203685372211120018=[51000-3355471052-0]10=100
20170203-15:44:04.285 : 8=FIX.4.49=10335=349=FG56=tgFZctx200U6134=552=20170203-15:43:57.03345=4371=372373=1158=Invalid MsgType372=810=164
cancelling an order:
20170203-15:26:19.178 : 8=FIX.4.49=15435=F34=349=tgFZctx200U6152=20170203-15:26:19.17856=FG11=270061237=57286383038=141=2700644=116470.0000054=155=RTS-3.1760=20170203-18:26:19.17810=013
20170203-15:26:19.188 : 8=FIX.4.49=20735=849=FG56=tgFZctx200U6134=352=20170203-15:26:11.92437=572863830198=F:572863830526=$01$11=270061241=2700617=exec-201702031001027615150=639=655=RTS-3.17461=FXXXXX54=138=140=2151=114=06=010=239
20170203-15:26:19.418 : 8=FIX.4.49=11535=j34=449=tgFZctx200U6152=20170203-15:26:19.41856=FG45=358=Conditionally Required Field Missing372=8380=510=070
20170203-15:26:19.418 : 8=FIX.4.49=33335=849=FG56=tgFZctx200U6134=452=20170203-15:26:11.92437=572863830198=F:572863830526=$01$11=270061241=27006453=1448=tgFZctx200U61447=C452=317=3354681208150=439=41=FZ00U6155=RTS-3.1754=138=140=244=116470.00000336=9291151=014=06=060=20170203-15:26:11.93120008=-922337203685267353520018=[51000-3354681208-0]10=080
20170203-15:26:19.418 : 8=FIX.4.49=10335=349=FG56=tgFZctx200U6134=552=20170203-15:26:12.16445=4371=372373=1158=Invalid MsgType372=810=161
Best regards, Mikhail
"Conditionally Required Field Missing" means you are trying to extract an optional field that isn't present. (It's not required by the DD, but the user's logic expects it to be there, hence "conditionally required".)
The first 35=j message says:
45=3 - sequence number of message where these happened
58=Conditionally Required Field Missing
372=8 - type of message where this happened
380=5 - same code as explained in 58
Unfortunately, the message doesn't say which field is the problem, but basically, you're doing this (forgive my pseudocode):
var x = msg.getSomeOptionalField()
but you need to do this:
var x = null;
if (msg.checkIfSomeOptionalFieldIsPresent())
x = msg.getSomeOptionalField();
In order to parse your own FIX messages use FIXimate.
58 is a text field. The text after 58 in this case is the error message. The tag value pair 372=83 means: The message referred to (i.e. the missing tag) is tag 83.
Tag 83 is the sequence number of message within report series. FIXimate says that 83 is "Used to carry reporting sequence number of the fill as represented on the Trade Report Side."
This is your FIX engine sending an error back to the exchange. You can tell by looking at the SenderCompID and TargetCompID for each message.
You send a message:
20170203 15:44:04.225:8=FIX.4.49=15135=G34=349=tgFZctx200U6152=20170203-15:44:04.22556=FG
You get an Execution Report (35=8, probably acknowledging order cancellation/replace):
20170203-15:44:04.225 : 8=FIX.4.49=23235=8 49=FG 56=tgFZctx200U61lo9
You send an Business Reject (35=j):
20170203-15:44:04.275 : 8=FIX.4.49=115 35=j 34=4 49=tgFZctx200U61 52=20170203-15:44:04.275 56=FG 45=358=Conditionally Required Field Missing372=8380=510=065
What this last message coming in from the exchange is, is hard to tell without further analysis, but it most likely the execution report for the replaced order. It seems to have been sent 1 ms after the original execution report.
Your FIX engine expects certain data to be present within the messages. The expectation is set in your data dictionary, an xml file which should be provided by your counterparty. Sometimes (like now) there are errors in this file and you have to open it up, find the message in question (in this case the original execution report), and tell your data dictionary not to expect tag 83.
That should clear things up. Let me know if it doesn't work.