On Sep 27, 2014, at 14:25, Antonio Fortin wrote:

> `theFile` expands to the HFS path for the file, so it’s surprising that it 
> stumps BibDesk.  
> 

Again, an HFS path is a string. It's not a file object. You have to make it in 
to a file object. So that's not surprising at all. Moreover, an HFS path is an 
anachronism,  leftover from classic mac. 

> My (limited) understanding of file objects is that they’re only recognised by 
> Finder and System Events.app.

Those are different file objects, that are defined in those apps. I am talking 
about generic file objects, that are defined in the basic AppleScript support 
itself. (The fact that they are different things is one reason why files in 
AppleScripts have always been a big mess.)

> In any case, this still does nothing if I run it on its own (not as part of a 
> Hazel rule):
> 
> `
> set theFile to POSIX file "/Users/antonio/foo.pdf"
> tell application "BibDesk"
> if (count of documents) is 0 then make new document
> tell front document
> set thePub to make new publication
> add theFile to thePub
> end tell
> end tell
> `
> 
> This just returns `file “MBA:Users:antonio:foo.pdf”` but doesn’t add the PDF 
> to BibDesk.
> 
> —Antonio
> 

Are you sure the file exists? If it doesn't, there is nothing to add. With an 
existing file, this does definitely work for me.

Christiaan

> On 27 Sep 2014, at 14:02, Christiaan Hofman <[email protected]> wrote:
> 
>> What format does theFile come in? Is it really a file object? Or is it a 
>> string? In the latter case you have to convert it to a file object.
>> 
>> Christiaan
>> 
>> On Sep 27, 2014, at 13:57, Antonio Fortin wrote:
>> 
>>> In Hazel, `theFile` is an AppleScript variable that’s used to refer to the 
>>> file being processed. In this case, it’s the PDF that’s tagged with the 
>>> `BibDesk` tag, which triggers the rule.
>>> 
>>> —Antonio
>>> 
>>> 
>>> On 27 Sep 2014, at 13:50, Ken Mankoff <[email protected]> wrote:
>>> 
>>>> How does that script know what theFile is?
>>>> 
>>>> Please excuse brevity. Sent from pocket computer with tiny non-haptic 
>>>> feedback keyboard. 
>>>> 
>>>> On Sep 27, 2014, at 7:06, Antonio Fortin <[email protected]> 
>>>> wrote:
>>>> 
>>>>> Hi Christiaan,
>>>>> 
>>>>> Many thanks for that. However, when I trigger the script in Hazel, the 
>>>>> PDF in question doesn’t get added to BibDesk. I know that the rest of the 
>>>>> rule is working, because it does other things (like remove the tag).
>>>>> 
>>>>> I suspect I haven’t set it up correctly, however. I’ve attached a 
>>>>> screenshot of the rule. Does it work for you, as it is?
>>>>> 
>>>>> I’ll almost always want to import to an existing library when BibDesk is 
>>>>> already running, so I’m not worrying about the conditional statement or 
>>>>> activating BibDesk just yet.
>>>>> 
>>>>> Thanks again.
>>>>> 
>>>>> Best,
>>>>> Antonio
>>>>> 
>>>>> <hazelBibDesk.jpg>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On 26 Sep 2014, at 23:04, Christiaan Hofman <[email protected]> wrote:
>>>>> 
>>>>>> 
>>>>>> On Sep 26, 2014, at 19:54, Maxwell, Adam R wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On Sep 26, 2014, at 08:17, Christiaan Hofman <[email protected]> wrote:
>>>>>>> 
>>>>>>>> AppleScript could very well do this. But how to write that AppleScript 
>>>>>>>> really depends on how you want to use it and what you want precisely 
>>>>>>>> to do. Probably you need some AppleScript like the following (here I 
>>>>>>>> assume theFile is the file you want to add):
>>>>>>> 
>>>>>>> The same script would also work if you have BD set to open a particular 
>>>>>>> .bib file at launch, right? That would allow the OP to append new PDFs 
>>>>>>> to the same .bib database.
>>>>>>> 
>>>>>>> Adam
>>>>>>> 
>>>>>> 
>>>>>> Yes, it should. Though if you want to apply this also in cases where 
>>>>>> BibDesk should launch, then you probably also want to add an "activate" 
>>>>>> command somewhere. And I can imagine there may be timing issues (i.e. it 
>>>>>> checks for the count of documents before the initial file was launched), 
>>>>>> though a quick test does seem to work.
>>>>>> 
>>>>>> Christiaan
>>>>>> 
>>>>>> ------------------------------------------------------------------------------
>>>>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>>>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>>>>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>>>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
>>>>>> Bibdesk-users mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
>>>>> 
>>>>> ------------------------------------------------------------------------------
>>>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>>>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>>>>> _______________________________________________
>>>>> Bibdesk-users mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
>>>> ------------------------------------------------------------------------------
>>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
>>>> Bibdesk-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
>>> 
>>> ------------------------------------------------------------------------------
>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
>>> Bibdesk-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
>> 
>> Christiaan
>> 
>> ------------------------------------------------------------------------------
>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
>> Bibdesk-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
> 
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk_______________________________________________
> Bibdesk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Christiaan

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Bibdesk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

Reply via email to