Sure, just add:

        if newDOI starts with "doi:" then
                set newDOI to text 5 thru -1 of newDOI
                set field "doi" of thePub to newDOI
        end if

Or here's some lazy (and bad) code that looks for the first numeric  
character:

repeat with iChar from 1 to number of characters of newDOI
        if character iChar of newDOI is in "0123456789" then exit repeat
end repeat
set newDOI to text iChar thru -1 of newDOI
set field "doi" of thePub to newDOI


On 2008-05-05, at 10:24 AM, Adam R. Maxwell wrote:

>
> On Monday, May 05, 2008, at 09:56AM, "Alex Montgomery" <[EMAIL PROTECTED]>  
> wrote:
>> On 2008-05-04, at 6:40 PM, Adam R. Maxwell wrote:
>>
>>> Indeed.  It might be feasible to extend the current special-case
>>> handling of DOI, but special cases suck.  You could look into  
>>> adding a
>>> script hook that fires when the DOI field is set, and then the  
>>> onus is
>>> on you to keep it working :).  I think that's actually the way DOI  
>>> is
>>> designed to work, but it would have been easier if they'd made it a
>>> URL instead of a URI that requires additional context (e.g. as an
>>> attribute in XML) to be useful.
>>
>> That's exactly what I've done. The following not only sets a URL, but
>> also checks your URLs to see if a previous value of the DOI is  
>> entered
>> as a URL, and replaces it if needed. If you delete the DOI, it  
>> deletes
>> the URL as well.
>
> Thanks!  This works really well.  How hard would it be to strip any  
> leading non-numeric characters, so it would work with stuff like doi: 
> 10.xxx?  BibDesk uses the fact that DOI names always starts with  
> "10" to normalize strings before converting them to DOI:
>
> http://www.doi.org/handbook_2000/enumeration.html#2.2  (see 2.2.1)
>
> Sometimes I wish I could write AppleScript as well as read it...
>
> -- 
> adam
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save  
> $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Bibdesk-users mailing list
> Bibdesk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to