Sorry, I should be clearer. This is what happens when you try to work through a headache.

The script hook does not generate a local-url field when I drop a file from my hard drive onto the sidebar. When I drop a local file onto the sidebar, I can see no change in the entry (as opposed to when I run the same script manually, when the Local-Url and Url fields are generated immediately).

Best,
-Nathan
----------
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ======================================================================== When you have to stay eight years away from California, you live in a perpetual state of homesickness.
        - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
        -Coco Chanel
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ========================================================================

On 4 Dec 2008, at 7:53 PM, Christiaan Hofman wrote:

Huh? It does not generate a file, it only generates a Local-Url field.

Christiaan

On 5 Dec 2008, at 1:46 AM, Nathan Paxton wrote:

Hmm. This helps. I will try it post-haste, but there does not seem to be an automatic generation of the linked file on my hard drive when I drop the PDF onto the sidebar.

Best,
-Nathan
----------
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ===================================================================== When you have to stay eight years away from California, you live in a perpetual state of homesickness.
        - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
        -Coco Chanel
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =====================================================================

On 4 Dec 2008, at 7:41 PM, Christiaan Hofman wrote:


On 5 Dec 2008, at 1:28 AM, Nathan Paxton wrote:

        Alex (et al.),

That was exactly what I needed. I had sort of inferred that something like that might be the case.

And Christiaan's clarification that the hook only gets invoked (in this case) upon some action helps also.

So, I'd be happy to write some clarification of what each of the hooks do, after I figure that out.

Now, I've added the LinkedFilesToFields script to the Add File or URL hook. My understanding is that when I drop a webpage or PDF document into the entry window sidebar, I should get a Url or Local-Url field generated, with the path to the webpage or document in it. Is that it? Because the Url field generation only occurs when I manually run the script on the entry, not automatically upon dropping a weblink onto the sidebar.


The script hook on the Wiki only handles linked files, not linked URLs. It's not too hard though to modify the script to also handle remote URLs. Basically, you should copy the "if" block for "Local File", and add a "else if" block to it for "Remote URL". Something like this:

...
else if theField is "Remote URL" then
    repeat with thePub in thePubs
        tell thePub
            if ((count of (get linked URLs)) > 0) then
                set theURL to linked URL 1
                set the value of field "Url" to theURL
            end if
        end tell
    end repeat
end if

Also note that the script hook only copies the first linked file, while the script from the list copies all linked files or URLs (if there are more than one).

Christiaan

        Thanks for all the help, all.

Best,
-Nathan
----------
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =================================================================== When you have to stay eight years away from California, you live in a perpetual state of homesickness.
        - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
        -Coco Chanel
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ===================================================================

On 4 Dec 2008, at 7:06 PM, Alex Hamann wrote:


On 04.12.2008, at 22:12, Nathan Paxton wrote:

        Ah, *that's* what the script hooks pref menu is for! I've never
understood that.

        So I simply go to Script Hooks in the preferences, select Add to
File or URL (and Did Auto File), and then select
LinkedFilesToFields.scpt for the script file? And this will then
automagically take the url/location of the included files (over in
the preview sidebar) and put it in URL/file/DOI fields that the
script has just created?

        I would wager that there are other non-beginner users out there
who don't quite understand what the script hooks preferences and
all are about. How could the BD project go about explaining the
script hooks preferences panel, what the hooks are, and so forth? I know there's basic documentation on the wiki, but I can't say that
I quite understand what's going on based on that. I'd be happy to
help, but since I'm only fuzzily understanding this myself, I'm not
good to lead/start a beefing up of the documentation.

Best,
-Nathan
----------
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton


Hi Nathan,

I might be too basic here but maybe it helps clarify things. You
should be aware of the difference between a script and a script hook.
An applescript is a small script file that is being kept in the
respective BibDeks scrip folder and that can be invoked via the
script menu in BD's menu bar. This will run the specific script and
perform the relevant actions.
A script hook is a way of automatically invoking such a script
whenever a specific action is performed. Nevertheless, the script
will be basically the same type of file, just the way it is being
invoked is different: manually in the first case, automatically in
the latter.
Applescript is a tricky thing to get into: I myself have made several
attempts and ended them in frustration each time. Still, the best
approach seems to be to try to understand a simple script and then
try to think about ways it would work using a script hook.
Sorry, if this was all clear to you.

Alex



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to