Get URL from Mail message to Safari
I want to be able to email myself at home from work with a URL in the body of the message. I want a Mail rule and Automator (or applescript if necessary) to take that URL from the message body and send it to Safari which will go to the URL. The URL can be either a web page or downloadable file.
Quad G5 Mac OS X (10.4.7) 4.5GB RAM
Shoot! I wrote this huge reply and then quit Safari by accident. I'm too tired to type it all over again (I should install a keylogger).
Anyway, check out the screen shot of my workflow. the AppleScript section is where it xfers the URL from a text editor (BBEdit) to Safari. It's pretty dirty but it works.
http://www.jameskocsis.com/urlworkflow.jpg
post antother reply if you need more data on this process.
Good luck.
-James
Similar Messages
-
Applescript get text from mail message
Hi,
I've got a nested script that ideally would work with a multiple selection of emails. Most of the script does but I've recently found the need to add the sender's delivery address to the outgoing message. I've found a way to insert the clipboard but that leaves me only being able to send out one message at a time and I have to copy the address for each message to the clipboard first. I made a script to do that bit once I'd selected the text but this only works from Applescript Editor and not Quicksilver which is what I normally use.
So, what I'm hoping is someone would be able to help me with the a, select the right bit of text between Delivery address: and Instructions to merchant: of each message and have that work with Quicksilver and b, tell me why the following script only partially works from Quicksilver, i.e. the top bit, copy to clipboard, doesn't work.
Thanks.
tell application "System Events"
tell application "Mail" to activate
key code 8 using command down
end tell
tell application "Mail"
set thesenders to {}
set thesenderstext to ""
set myaddress to the clipboard
set theMessages to the selection
repeat with eachMessage in the theMessages
repeat with i from 1 to the number of items in eachMessage
set theAccount to "[email protected]"
set theSender to (extract address from (the reply to of (item i of eachMessage)))
if thesenders does not contain theSender then
set thesenders to {theSender}
end if
set replyName to (extract name from (the sender of (item i of eachMessage)))
set titleCaseString to (do shell script "/bin/echo" & space & quoted form of replyName & space & "| /usr/bin/perl -p -e 's/(\\w+)/\\u\\L$1/g;'") as Unicode text
set firstName to word 1 of titleCaseString
end repeat
set AppleScript's text item delimiters to ", "
set thesenderstext to thesenders as rich text
set AppleScript's text item delimiters to ""
set newMessage to make new outgoing message
set theSubject to "instructions"
set theContent to "Dear " & firstName & ",
Thanks so much for your order.
You will receive a despatch notice by email when your order is sent.
Your Order is being sent to:
" & myaddress & "
Kind Regards
Jim
set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
set theAttachment1 to POSIX file "/Users/Jim/qrcode.13177607.png"
set theAttachment2 to POSIX file "/Users/Jim/qrcode.13177658.png"
set theAttachment3 to POSIX file "/Users/Jim/qrcode.13177665.png"
tell newMessage
set visible to true
make new to recipient with properties {address:thesenderstext}
--make new bcc recipient at end with properties {address:theBccRecipient}
make new attachment with properties {file name:theAttachment1} at after the last paragraph
make new attachment with properties {file name:theAttachment2} at after the last paragraph
make new attachment with properties {file name:theAttachment3} at after the last paragraph
-- send
end tell
tell application "Mail"
set a to selection
repeat with s in a
set flag index of s to -1 as integer
end repeat
set theSelection to the selection
repeat with theMessage in the theSelection
move theMessage to mailbox "orders" -- of account theAccount
activate
end repeat
end tell
end repeat
set read status of every message of mailbox "orders" to true
end tellShoot! I wrote this huge reply and then quit Safari by accident. I'm too tired to type it all over again (I should install a keylogger).
Anyway, check out the screen shot of my workflow. the AppleScript section is where it xfers the URL from a text editor (BBEdit) to Safari. It's pretty dirty but it works.
http://www.jameskocsis.com/urlworkflow.jpg
post antother reply if you need more data on this process.
Good luck.
-James -
Hello Applescript-Meisters,
I have the following problem:
Every week we receive an email which contains a secure URL (https://) with always different username and password to download a ".tar" file.
Since I'm new to Applescript I tried to extract the paragraph of the email message with the line which contains the URL, but doesn't seem to work:
tell application "Mail"
set theMessages to message 1 of mailbox "EXAMPLE" of account "AccountTest" whose subject begins with "Data request"
set theContent to content of theMessages
set someData to paragraphs of theContent
repeat with someData in theContent
if someData begins with "https://" then
set theURL to paragraph of someData
else
set theURL to paragraph 18 of theContent -- this works but this line can change weekly
end if
end repeat
end tell
Any help or suggestions would be greatly appreciated.
Cheers,
gillesThe most obvious problem is how you're trying to iterate through the paragraphs.
You start off with:
set theContent to content of theMessages
which is fine - theContent now contains the text of the email.
You then extract the paragraphs of that text:
set someData to paragraphs of theContent
But you then reset 'someData' to be the iterator in a loop:
repeat with someData in theContent
Additionally, you're iterating through theContent, which is a single block of text.
I think what you mean to do is iterate through the paragraphs of theContent, like:
repeat with someData in (get paragraphs of theContent)
Once you have this, you know someData is the paragraph you're currently looking at so you can:
set theURL to someData
Finally, you do not want an 'else ... set theURL' statement because that will reset theURL every time you find a line that doesn't begin with "https://" (e.g. if paragraph 10 starts with https:// you set theURL to that paragraph, but as soon as you move onto line 11 you reset theURL because the paragraph doesn't begin with https://
To address this you should just iterate through the paragraphs and only set theURL to paragraph 18 if you didn't find any matching lines.
Putting it all together:
set theURL to "" -- default value for theURL
theContent to content of theMessage
repeat with someData in (get paragraphs of theContent)
if someData begins with "http://" then
set theURL to someData
end if
end repeat
if theURL = "" then
try
set theURL to paragraph 18 of theContent
end try
end if
Note that I've included the 'paragraph 18' line in a try block. That's so that the script doesn't fail if there are less than 18 paragraphs in the message (you can't get paragraph 18 of a 17-paragraph document). -
You know how you can easily send a URL from Safari to Mail (Shift-Command-I)? Why can't you do that in reverse?
I want to be able to email myself at home from work with a URL in the body of the message. I want a Mail rule and Automator (or applescript if necessary) to take that URL from the message body and send it to Safari which will go to the URL. The URL can be either a web page or downloadable file.
Quad G5 Mac OS X (10.4.4) 4.5GB RAMZach Barocas,
With the webpage open, tap on the "+" symbol at the bottom and choose " "Mail Link to this Page".
iPhone User's Guide, Page 56:
http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf
Hope this helps,
Raleigh -
Stripping Attachments from Mail messages.
Does anybody know of a utility for stripping out attachments from Mail messages so as to save storage space?
Hey thanks for the suggestions.
Firstly, embedded attachments can be dragged out of the email messages on Windows as they can on OS X.
Getting our clients to work like this could be difficult as they all have 1024px screens and from what we've seen they always have their windows maximised (in fact most Windows users seem to do this). But we'll suggest it.
Secondly, when you next plan to make an attachment be sure to use the menu or toolbar option for selecting an attachment. When the Choose File dialog appears you will see a checkbox in the lower left labeled "Use Windows friendly attachments." Be sure that option is checked.
We do this but it still doesn't seem to work - maybe their MailMarshal software is causing this?
Thirdly, be sure any attachment you send has the proper extension. For example, PDF files should have ".pdf", and JPEGs should have ".jpg" or ".jpeg" in order to be consistent with what Windows applications expect.
Yes, we do this.
Fourthly, often certain documents on OS X do not have an extension or the extension is slightly different, for example, Word documents may be ".docx" on the Mac, but need to be ".doc" in order for Word for Windows to open the document by double-clicking.
Have come across this also.
Fifthly, ZIP files should not normally be confused with junk. Your IT department may need to consider making some changes to their email filtering software.
We don't have an IT department, and based on recent conversations with their IT guys, they're definitely not interested in taking suggestions on email security from Mac users!
Will see how we go with getting our clients to work differently but I'd personally prefer to sort it our end - from their point of view it's a Mac issue and from what I can see I think they might be right. -
When and how does the message context get removed from the message when we use pass thru send port
Friends,
i have a doubt regarding message context.
Assume i have used XMLRecieve pipeline in the receive side to receive the message so that the message context is created. I.e properties are promoted/written.
now if we use pass thru transmit pipe line at send side, how and when does the message context get removed from the message?? Since pass thru does not have any stages/components, how does the message context removed and sent out a pure message to destination???
i mean what exactly happens here to remove the context??
RavindarThanks for the reply.
"The Context is created by the Adapter, regardless of any Pipeline or Pipeline Component. It has nothing to do with PassThrough vs. XmlReceive, although XmlReceive will write Promoted Properties to the existing Context,
as can any other Component."
yeah yeah, adapter does create some properties in context. You are right, i am aware of it. I just missed to explain it clearly. what i meant is addition of context properties will not happen if pass thru used. Thanks its clear.
"No. The Context already exists on the Message when it comes from the MessageBox and
is equally available to any Component in any Stage. The Context that hits the Pipeline is whatever was last Persisted, either by a Receive Port or Orchestration. It is not created by the XmlAssembler (XmlTransmit)"
You are right , the context already exists on the message while it leaves the receive port, and once it persists
to message box the context and message context gets stored in messages in relative tables.
Now as you said the components get the message from the last persistence, assume i have a send port(with passthru)
subscriber and a orchestration subsrciber for this message.
Orchestration gets the message with context right!!
if the send sendport(with passthru) also gets message along with context, then where is this context removed/demoted
while sending it out?. i guess as per SAAkhlaq said,
here sendport(with passthru) should get a pure message without context as passthru used.
or is it that ultimately send adapter removes the context completely?
or is it something like biztalk run time load the context from database into cache and both orchestration and send port gets pure message, and if needed they use context from cache???
sorry i may be troubling you, but i am confused. i hope i am not creating any nuisance with this
post.
Ravindar -
Unable to get filename from mail to XI to file scenario
Hi
How could i get the name of an attachment to be used as the file name on my File Adapter in a Mail to file scenario?
I recieve the files as attachments and I have used the payload swap bean to swap my actaull message content to attachment. That works perfect, the contents of the file are saved successfully on my file system. The file is sent as a plain text file and not xml and no mapping is done, I just get the files from the mail and save them into a file server for further processing.
Your help will be highly appreciated
RonnyHi
I have installed my Module, but when I try to call it from within the adapters I get an error
exception caught during processing mail message [614]com.sap.aii.af.mp.processor.ModuleProcessorException: Error during processing local bean: localejbs/mailAttachmentFileNames caused by: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of mailAttachmentFileNames.
I have searched all the logs and the module is active. I even restarted my J2EE engine, twice but still nothing..
please assist
Ronny -
Hi I'm trying to display a menu from a table, and then I want to mark the current page in that menu by reading the url of the current page.
This is what i've got so far:
DECLARE
loc Varchar2(40);
BEGIN
loc := htp.script('document.url');
htp.print('<table border=1>');
for rec in (select id, name, parent_id, url from fgj_menu where parent_id=0) loop
HTP.print ('<tr>');
HTP.print ('<td><a href="' || rec.url || '">' || rec.name || '</a></td></tr>');
for rec2 in (select id, name, parent_id, url from fgj_menu where parent_id = rec.id) loop
if rec2.url = loc then
HTP.print ('<tr>');
HTP.print ('<td> >> <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
else
HTP.print ('<tr>');
HTP.print ('<td> <a href="' || rec2.url || '">' || rec2.name || '</a></td></tr>');
end if;
end loop;
END LOOP;
htp.print('</table>');
END;fails on 4th line :
loc := htp.script('document.url');Any suggestions?
Message was edited (format edits) by:
BotzyHi Botzy
You can put your javascript code in an HTML portlet, but I prefer to put a page under htdocs, it's much easier to develop, and then use an url item that displays the url directly in the page.
About the code :
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
xhr_object.open("POST", "/portal/pls/portal/my_schema.my_proc", true);
xhr_object.onreadystatechange = function()
if(xhr_object.readyState == 4) alert(xhr_object.responseText);
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr_object.send('p_param1=value1&p_param2=value2');
That's really simple to use, you just have to change the name of your proc and its parameters, and you'll get what it "htp.prints". Be sure to grant exec to public on you proc.
By the way, I've just imagined an even more simple solution :
- do not pass any param to your procedure. Let it just write always the same code whatever the page it is on
- identify each entry of your menu with a javascript id, for instance
<table>
<tr><td id="url1">page 1</td></tr>
<tr><td id="url2">page 2</td></tr>
etc...
Then use a small javascript code at the end of your page with something lie this :
document.getElementById(document.location.href).style = a different color
or
document.getElementById(document.location.href).innerHTML = something different
or whatever you want. -
Hello,
I feel like this is something simple but I cannot write a correct script to do it.
How would I write a script that just gets the urls of all tabs in safari?
then if one exists, it selects that tab to be opened.Would It be easier that instead of telling safari to open that tab if it exists, to set the beginning part of my script that gets info from safari to get info from all tabs, for a specific tab only?
I don't understand your goals to be able to tell you what you want. Given what you've said in earlier posts it sounded like you wanted to see if a particular URL was present in any tab and if so activate it. That doesn't seem to be the case any more. You'll need to more clearly explain what you're trying to do in order to progress.
I purchased a book http://apress.com/book/view/1430223618 which I am going to use to better help me make applescripts as well as cocoa-applescript applications in xcode. Do you think this book will be able to help, or is there another I should look at?
That book, like most others, covers a lot of the theory behind AppleScript - the concepts behind AppleScripts/Apple Events, and things like handlers, process flow, etc.
It will not tell you how to do what you want, because what you want is something very specific - unique, even. What it might do is give you the fundamental building blocks to work out how to build your script to do what you want. For example, I've shown you some examples of how to find out what tabs are present, how to activate a tab, how to switch windows, etc. The book might do the same thing (albeit spread throughout several chapters). It's a matter of putting that together in a way that achieves your goal. -
Get URL from within a Ejb-Container
Hi all,
I try to realize a WD-Application with Hibernate ORM. Now it seems , that from within the Ejb the hibnerate.cfg.xml couldn't be found.
No I try to read the URL from hibernate.cfg.xml. There I did some test with the getResource()-Function. At least I managed to get a URL from a zip-archive, but I'm not able to found the URL from something inside the archive, <b>and my configuration is in an archive!!!</b>
See the following tests:
URL myurl11 = cl.getClass().getResource("/"); //works
URL myurl12 = cl.getResource("/"); //works not! (without getClass())
URL myurl2 = cl.getClass().getResource("/version.txt"); //works
URL myurl3 = cl.getClass().getResource("version.txt");//works not (relativ)
URL myurl4 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip");//works
URL myurl5 = cl.getClass().getResource("/apps/sap.com/dc/oracle/ear/src/java/src.zip");//works not
URL myurl6 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de/pa/ejb/systeme/SystemeDao.java");//works not
URL myurl7 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de.pa.ejb.systeme/SystemeDao.java");//works not
URL myurl8 = cl.getClass().getResource("/apps/sap.com/dc~oracle~ear/src/java/src.zip/de.pa.ejb.systeme.SystemeDao.java");//works not
As you can see with "myurl14" it works for a zip-file but not futher. How can I get Into an archive? Or even adress things relative?
Can anybody help me?
Thanks
RichardHi Joe,
Thanks a lot for ur reply,
But the LD_LIBRARY PATH is set to the user that runs the App Server, Since it is throwing a UnsatisfiedLinkError, there must be a problem with the link only(i.e calling native method).
The flow of data is as follows
1 A method from ejb calls another java method in an other java class which is in the same jar file,passing the actual arguments.
2 That java method calls the Native methos residing in the same class file
3 The Native mentod calls a c function as usual
My ejb is working fine up to the Native Method call, at this point it is throwing an error
All my java files are in a package, and my .h file contains package name in the prototype of c function
If you get any ideas please mail me ASAP
ThanQ
Kiran -
Why can't I get mobile me mail even tho safari etc work OK?
I'm connected to the Internet via wifi in a hotel. I can surf and use other Internet based apps, but my Apple mail ( I.e. Mail from my mobile me account) has stopped working. I have tried both push ( my default method) and manual fetch, but when I go to my Mail In box, the 'wait' wheel spins forever. The iPad doesn't let me view my mobile me mail in any other way, such as via Safari. What can I do?
I just had an idea - maybe this hotel system doesn't support IMAP. As far as I know, this is the only way one can get MobileMe mails on an iPad. I have another account with a French ISP, and their IMAP service doesn't work here either, but I can get to them via webmail on Safari. Unfortunately Safari blocks this method on the iPad when it comes to MobileMe accounts. Can anyone suggest anything?
TIA -
Why can I no longer print an e-mail message in Safari-it deletes the left hand portion of the window
Since updating Safari I can no longer print an entire e-mail message. It does not print the left portion of the content of the window.
Open System Preferences > Print & Scan > Print > Open Print Queue
Delete all files to be printed.
Restart your Mac and try printing the email.
If that didn't help, empty the Safari cache. Command + Option + E
Quit and relaunch Safari to test.
If that didn't help, might be corrupted printing preferences.
Open the Finder. From the Finder menu bar click Go > Go to Folder
Type or copy paste the following:
~/Library/Preferences/com.apple.print.PrintingPrefs.plist
Click Go then move the com.apple.print.PrintingPrefs.plist file to the Trash.
Quit and relaunch Safari and try again.
message edited by: cs -
How to get filename from mail attachment
Hi all,
I have a XI scenario Mail->XI->RFC. I have created my own adapter module which handle all attachments from incoming mail.
Everything work fine, but in my module I try to get information about filename of mail attachment. I use getContentType() metod to get the filename but this method return only the mimetype of the document. The getDescription() method return olny string "mail attachment". I need to get the original filename of the attachment or at least the file extension.
Is it possible to get the whole filename from mail attachment?
Thanks
PeterHi,
You can tryout with adapter modules . You can make use of following Adapter attributes also -
http://help.sap.com/saphelp_nw2004s/helpdata/en/ad/bf93409c663228e10000000a1550b0/content.htm
Similar discussion-
Email attachment file names
PayloadSwapBean-
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
Regards,
Moorthy -
Is it possbile to get URL from the browser address bar?
Hi
I'm in the process of creating a JITIR agent in java that takes in the url of the website that the user presently viewing.
I don't want the user to have to copy or type in to my app the websites URL. Is it possbile to get this from the process e.g. The browser address bar, or the HTTP:// request sent by the browser.
Any thoughts gratefully recieved.
PhilI'm in the process of creating a JITIR agent in javawhat's this?
robert -
Hello,
How do I get the URL from HTMLImg? I get the HTMLImg object from
GetImageForResultFromSource
I am using C# in 5.0.4
Thank you.not with Java ... and only if IE actually provides an API that lets you get it. And only if you can get a reference to the IE process.
It's really more an IE question, not Java.
Maybe you are looking for
-
Can not "select" partitioning snapshot ?
I can create partitioning snapshot ( Oracle 8 ) , but I can issue SELECT statement with partition-extended object name Ex : Selet * from snapshot_name patition ( par_name ) How to SELECT data from snapshot with partition-extended object name ? null
-
what are the different status available for an order document. what is the table field that refers to?
-
Bypass automatic proxy configuration for some websites?
Here's my problem, perhaps someone can help: I occassionally need to use my university's proxy server to access library materials, etc., through my off-campus connection. So I entered the .pac file (a url) in the Automatic Proxy Configuration box of
-
When I attempt to open Premiere Elements 12, I get and error message saying that there is an incompatible display driver and I should update it to get faster playack. I went to update all driver's, and they were already updated. Not sure where to g
-
How can I update the iphone to IOS versions that support the apps I want?