Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

URL / Webloc drop

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  InDesign Problem: Importing Text Loses Formattin..  
Author Message
Rik

External


Since: Jul 17, 2004
Posts: 3



(Msg. 1) Posted: Sat Jul 17, 2004 11:54 am
Post subject: URL / Webloc drop
Archived from groups: alt>comp>lang>applescript (more info?)

Does anyone have any pointers or sample code to handle the drop of a URL
or "webloc" from something like Safari on to an Applescript application?

I'm not having too much luck getting this working.
Many thanks.
--
rik

 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
Chris Schram

External


Since: Jul 08, 2003
Posts: 34



(Msg. 2) Posted: Sat Jul 17, 2004 2:00 pm
Post subject: Re: URL / Webloc drop [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Rik wrote:

 > Does anyone have any pointers or sample code to handle the drop of a URL
 > or "webloc" from something like Safari on to an Applescript application?

Maybe I'm missing the big picture here (wouldn't be the forst time), but
why not just double-click the .webloc file? What exactly are tou trying
to do?

--
schram RemoveThis @webenet.net is a filtered spam magnet. Email replies may not
get through. Use cschram instead. <http://www.webenet.net/~schram/>
C's Attic Sale <http://www.webenet.net/~schram/Chris/sale.html>
M's Music Sale <http://www.webenet.net/~schram/Martha/Music4Sale.html>

 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
Jerry Kindall

External


Since: Jul 09, 2003
Posts: 560



(Msg. 3) Posted: Sun Jul 18, 2004 12:38 am
Post subject: Re: URL / Webloc drop [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article , Chris Schram
wrote:


 >
  > > Does anyone have any pointers or sample code to handle the drop of a URL
  > > or "webloc" from something like Safari on to an Applescript application?
 >
 > Maybe I'm missing the big picture here (wouldn't be the forst time), but
 > why not just double-click the .webloc file? What exactly are tou trying
 > to do?

Obviously, Rik wants to do something with the URL inside the file.

To actually get to the URL, you're going to need some way to read the
resources, as the URL is stored in a 'url ' resource. The page title
is stored in a 'urln' resource. (The URL also appears in the 'TEXT'
resource.)

It looks like what you need is the SatImage scripting addition here:

<a rel="nofollow" style='text-decoration: none;' href="http://www.satimage.fr/software/en/downloads_osaxen.html" target="_blank">http://www.satimage.fr/software/en/downloads_osaxen.html</a>

--
Jerry Kindall, Seattle, WA <http://www.jerrykindall.com/>

Send only plain text messages under 32K to the Reply-To address.
This mailbox is filtered aggressively to thwart spam and viruses.
 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
Rik

External


Since: Jul 17, 2004
Posts: 3



(Msg. 4) Posted: Sun Jul 18, 2004 7:53 am
Post subject: Re: URL / Webloc drop [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)



 > To actually get to the URL, you're going to need some way to read the
 > resources, as the URL is stored in a 'url ' resource. The page title
 > is stored in a 'urln' resource. (The URL also appears in the 'TEXT'
 > resource.)

 > It looks like what you need is the SatImage scripting addition here:
 >
<font color=purple> > <a rel="nofollow" style='text-decoration: none;' href="http://www.satimage.fr/software/en/downloads_osaxen.html</font" target="_blank">http://www.satimage.fr/software/en/downloads_osaxen.html</font</a>>

Thanks. I willl take a look at these examples.

What I am trying to do is create a droplet that will accept URLs that
are dragged and dropped from either a web browser or from a .webloc file
from Finder. I'm not currently sure which object type the URL from the
browser is (e.g. if you drag the URL icon from the URL bar on Safari).
--
rik
 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
nobody4

External


Since: Mar 17, 2004
Posts: 9



(Msg. 5) Posted: Sun Jul 18, 2004 9:54 pm
Post subject: Re: URL / Webloc drop [Login to view extended thread Info.]
Archived from groups: alt>comp>lang>applescript, others (more info?)

In article ,
news.TakeThisOut@tcpip.fsnet.co.uk (Rik) wrote:


 >
  > > To actually get to the URL, you're going to need some way to read the
  > > resources, as the URL is stored in a 'url ' resource. The page title
  > > is stored in a 'urln' resource. (The URL also appears in the 'TEXT'
  > > resource.)
 >
  > > It looks like what you need is the SatImage scripting addition here:
  > >
<font color=green>  > > <a rel="nofollow" style='text-decoration: none;' href="http://www.satimage.fr/software/en/downloads_osaxen.html</font" target="_blank">http://www.satimage.fr/software/en/downloads_osaxen.html</font</a>>
 >
 > Thanks. I willl take a look at these examples.
 >
 > What I am trying to do is create a droplet that will accept URLs that
 > are dragged and dropped from either a web browser or from a .webloc file
 > from Finder.

For webloc files, the Finder (10.3.4 works, older versions may be broken
though) should do just fine.

-- quick example. Drop ONE webloc on the droplet for results.
on open x
tell application "Finder"
set y to location of internet location file (x as text)
display dialog y
end tell
end open

If you want to do url's straight from the browser, I think you are going
to have to learn a little Cocoa. At the very least, it will require
something besides a standard script droplet (Applescript Studio App)
since droplets won't accept URL drops. You might find this interesting.

<a rel="nofollow" style='text-decoration: none;' href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/O" target="_blank">http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/O</a>
bjC_classic/Classes/NSPasteboard.html

I've got cocoa code lying around for NSTableViews and such, but not for
drops directly on an app's icon. It probably only requires you to
declare the URI handlers in the info.plist and catch it in the right
place though.

<a rel="nofollow" style='text-decoration: none;' href="http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServices" target="_blank">http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServices</a>
Concepts/LSCConcepts/chapter_2_section_4.html
 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
Rik

External


Since: Jul 17, 2004
Posts: 3



(Msg. 6) Posted: Wed Jul 21, 2004 7:54 pm
Post subject: Re: URL / Webloc drop [Login to view extended thread Info.]
Archived from groups: alt>comp>lang>applescript (more info?)

nobody wrote:

 > For webloc files, the Finder (10.3.4 works, older versions may be broken
 > though) should do just fine.
 >
 > -- quick example. Drop ONE webloc on the droplet for results.
 > on open x
 > tell application "Finder"
 > set y to location of internet location file (x as text)
 > display dialog y
 > end tell
 > end open
 >
 > If you want to do url's straight from the browser, I think you are going
 > to have to learn a little Cocoa. At the very least, it will require
 > something besides a standard script droplet (Applescript Studio App)
 > since droplets won't accept URL drops. You might find this interesting.
 >
<font color=purple> > <a rel="nofollow" style='text-decoration: none;' href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/O</font" target="_blank">http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKi...</fo</a>>
 > bjC_classic/Classes/NSPasteboard.html
 >
 > I've got cocoa code lying around for NSTableViews and such, but not for
 > drops directly on an app's icon. It probably only requires you to
 > declare the URI handlers in the info.plist and catch it in the right
 > place though.
 >
<font color=purple> > <a rel="nofollow" style='text-decoration: none;' href="http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServices</font" target="_blank">http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServi...</fo</a>>
 > Concepts/LSCConcepts/chapter_2_section_4.html

Thanks very much. That's really useful.
--
rik
 >> Stay informed about: URL / Webloc drop 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Drop down menu with AS in OSX - I am trying to do a drop down menu from with in a dialog box, with a list of the Colour Sync contents (~libary/ColorSync/profiles), but I want to break it up into CMYK profiles and RGB profiles. I use a OSAX which allows me to have multi buttons and drop...

Drap and Drop folder - Hi I am using Applescript Studio to create an application which allows me to interface to a device (a handheld hames machine). I am having trouble implementing a drag and drop interface. I can drag a file onto the application and that works fine,..

Managing drag and drop within a table view - Hi, I'm developping a custom display of my addres book (in order to check all informatiosn and rearrange some data that get cross mixed). In doing this I'm trying to enable the drag and drop operation from one cell of a table view to another one - same o...

Drag and Drop applet for UNIX Diction and Style? - I was wondering if there exists, (or anyone would take it on as a coding project, a drag and drop applet that would save a Style and/or Diction report- a readability score more or less, from a plain text file dropped upon this. This may very well alread...

Newbie question: Drag & Drop a file to a window - Hi Applescript gurus. I am new to applescript. I'm writing a simple applescript application with one script handling all GUI events. The GUI is one textured window with a few text fields and a button. I want the user to be able to drag files to the..
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]