Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

URL / Webloc drop

 
   Soft32 Home -> Mac -> Apple Scripts RSS
Next:  Scripting Icons on Desktop (Panther)  
Author Message
Rik

External


Since: Jul 17, 2004
Posts: 3



(Msg. 1) Posted: Sat Jul 17, 2004 4:01 pm
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
Back to top
Login to vote
Chris Schram

External


Since: Jul 08, 2003
Posts: 37



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

This message is not archived
Back to top
Login to vote
Jerry Kindall

External


Since: Jul 09, 2003
Posts: 1192



(Msg. 3) Posted: Sat Jul 17, 2004 11:38 pm
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:

> 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?

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:

http://www.satimage.fr/software/en/downloads_osaxen.html

--
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.
Back to top
Login to vote
Rik

External


Since: Jul 17, 2004
Posts: 3



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

>Jerry Kindall 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:
>
> http://www.satimage.fr/software/en/downloads_osaxen.html

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
Back to top
Login to vote
nobody

External


Since: Mar 17, 2004
Posts: 12



(Msg. 5) Posted: Mon Jul 19, 2004 1:17 am
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 DeleteThis @tcpip.fsnet.co.uk (Rik) wrote:

> >Jerry Kindall 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:
> >
> > http://www.satimage.fr/software/en/downloads_osaxen.html
>
> 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.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/O
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.

http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServices
Concepts/LSCConcepts/chapter_2_section_4.html
Back to top
Login to vote
Rik

External


Since: Jul 17, 2004
Posts: 3



(Msg. 6) Posted: Thu Jul 22, 2004 12:02 am
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.
>
> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/O
> 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.
>
> http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServices
> Concepts/LSCConcepts/chapter_2_section_4.html

Thanks very much. That's really useful.
--
rik
Back to top
Login to vote
Display posts from previous:   
Related Topics:
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 ...
       Soft32 Home -> Mac -> Apple Scripts All times are: Pacific Time (US & Canada) (change)
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

Categories:
 Windows
 Linux
  Mac
 PDA



[ Contact us | Terms of Service/Privacy Policy ]