I want to paste a specific text to an internal email app.
The script is:
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set mytext to "Order number: " & ordernumber & "\nDate: " & ddate & "\nDelivery number: " & delnumber & "\n\nHello " & name & ","
set the clipboard to mytext
tell application "System Events" to keystroke "v" using command down
However the text is pasted without line breaks when the script is executed.
The interesting thing is that elsewhere (Notes, Word, etc) it works as expected, only in the specific internal mail app I see it a single line. Is there any other workaround?
Thanks for your reply. Yes, I had tried with the return keys but no luck.
Then hopefully I thought of splitting the text to lines and deployed the following solution, which is not optimal but at least it works:
set the clipboard to myline1
delay 0.4
tell application "System Events" to keystroke "v" using command down
tell application "System Events" to key code 36
set the clipboard to myline2
delay 0.2
tell application "System Events" to keystroke "v" using command down
tell application "System Events" to key code 36
set the clipboard to myline3
delay 0.2
tell application "System Events" to keystroke "v" using command down
tell application "System Events" to key code 36
tell application "System Events" to key code 36
set the clipboard to myline4
I don’t know why you are talking about “Text Item Delimiters”.
No where in the code are you converting text to a list or vice-versa.
So it is completely irrelevant.
Or am I missing something?
Did you try:
set mytext to "Order number: " & ordernumber & return & "Date: " & ddate & return & "Delivery number: " & delnumber & return & return & "Hello " & name & ","
set the clipboard to mytext
tell application "System Events" to keystroke "v" using command down
You gave up quickly. Your solution is awkward for several reasons.
You tested your internal mail app with return(/r), then with linebreek(/n) , but haven’t tried combining them yet. Combination /r/n is not uncommon in internal applications. So, try this, maybe it works: