Drag and drop a Bookmark

Marty Knapp martyknapp at comcast.net
Mon Feb 28 01:52:42 EST 2011


I just realized I forgot to insert the script (time to go to bed!) This 
is to drag right from the browser to a field:

on dragdrop
    put url (the dragData) into theHTML
    put offset("<title>",theHTML)+7 into b
    put offset("</title>",theHTML)-1 into z
    put char b to z of theHTML into me
    put cr & the dragData after me --the URL itself
end dragdrop

One problem would be if there is no Title tag and the format of the tags 
may vary a bit.

Marty
> Hey Thomas,
>
> You need to get the contents of the dragData. Here's a quick a dirty 
> script that will put the name of the bookmark on line 1 and the url on 
> line 2. Put this in the field script:
>
> on dragenter
>   set the acceptdrop to true
> end dragenter
>
> on dragdrop
>    set the itemDelimiter to "/"
>    put item -1 of the dragData & cr into me
>    put url("file:" & the dragdata) into tData
>    get lineOffset("<string>",tData)
>    put char 10 to -10 of line it of tData after me
> end dragdrop
>
> Marty Knapp
>> Hi
>> I'd like to drag a bookmark off a browser and drop it in a field in 
>> LiveCode. So far I get only the titel of the bookmark in the field 
>> but not the URL. For instance, I get "iGoogle" but I would like to 
>> get "http://www.google.com/ig". Or even better, I want to retrieve 
>> both chunks. How do I do this?
>>
>> Thanks
>> Thomas




More information about the use-livecode mailing list