Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Mahmood Shafeie Zargar
Yes, I just noticed after your email. Great addition!

Thanks,
Mahmood

> On 12 Jun 2020, at 17:02, Christiaan Hofman  wrote:
> 
> BibDesk should be able to already do this for you.
> 
> Christiaan
> 
>> On 12 Jun 2020, at 11:19, Mahmood Shafeie Zargar  wrote:
>> 
>> Hi Luc,
>> 
>> I agree it would be great if BibDesk could at least give us the option.
>> 
>> BibDesk already has an Orphaned Files feature that you can use periodically 
>> to remove the files you don't need anymore from your attachments directory.
>> 
>> Otherwise, I use the following script with the Remove File hook to do just 
>> what you desire:
>> 
>> using terms from application "BibDesk"
>> on perform BibDesk action with publications thePubs for script hook 
>> theScriptHook
>> tell application "BibDesk"
>> set theField to get field name of theScriptHook
>> set oldValues to get old values of theScriptHook
>> if theField = "Local File" then
>> repeat with theFile in oldValues
>> set theAlertText to "File association removed."
>> set theAlertMessage to "You are detaching the file \"" & 
>> theFile & "\" from the corresponding publication. Would you like to delete 
>> the file from the file system as well?"
>> set result to display alert theAlertText message 
>> theAlertMessage as critical buttons {"Keep", "Remove"} default button 
>> "Remove" cancel button "Keep"
>> if button returned of result = "Remove" then
>> tell application "Finder" to delete theFile as POSIX 
>> file
>> end if
>> end repeat
>> end if
>> end tell
>> end perform BibDesk action with publications
>> end using terms from
>> 
>> 
>> Hope this helps,
>> Mahmood
>> On 12 Jun 2020, 11:05 +0200, Fischlin Andreas 
>> , wrote:
>>> Dear Luc,
>>> 
>>> Indeed, that would be annoying.
>>> 
>>> BTW, I offer on my website several AppleScripts which greatly support such 
>>> tasks. E.g. I can simply replace in the Finder an obsolete version of a PDF 
>>> with an updated one and then trigger with a shortcut (Ctrl^F) an 
>>> AppleScript that discards the old link and replaces it with a new link to 
>>> the new file. There is only one drawback for this to work, I use 
>>> information from the record to construct the file name. In my case I use 
>>> only the cite key with some suffixes if there are several PDF’s linked to 
>>> the same article, e.g. supplementary material, to name my PDFs.
>>> 
>>> Should you be interested, here the link: 
>>> https://www.sysecol2.ethz.ch/software/
>>> 
>>> Regards, 
>>> Andreas 
>>> 
>>> ETH Zurich
>>> Prof. em. Dr. Andreas Fischlin
>>> IPCC Vice-Chair WGII
>>> Systems Ecology - Institute of Biogeochemistry and Pollutant Dynamics
>>> CHN E 24
>>> Universitaetstrasse 16
>>> 8092 Zurich
>>> SWITZERLAND
>>> 
>>> andreas.fisch...@env.ethz.ch
>>> www.sysecol.ethz.ch/people/andreas.fischlin.hml
>>> 
>>> +41 44 633-6090 phone
>>> +41 44 633-1136 fax
>>> +41 79 595-4050 mobile
>>> 
>>>  Make it as simple as possible, but distrust it!
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
 On 12/06/2020, at 09:31, Luc Bourhis via Bibdesk-users 
  wrote:
 
 Hi,
 
 it would be sweet if BibDesk would propose to remove the actual file on 
 disk when one removes a link from a record. It happens every now and then 
 that either I filed the wrong file, or more often that I want to replace a 
 preprint by a later version or the published one. Currently, I have to 
 remove the link, add the new one, then use “Reveal in Finder” and remove 
 the old one. A bit tedious.
 
 Best wishes,
 
 Luc J Bourhis
 
> 
> ___
> Bibdesk-users mailing list
> Bibdesk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users



___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Christiaan Hofman
BibDesk should be able to already do this for you.

Christiaan

> On 12 Jun 2020, at 11:19, Mahmood Shafeie Zargar  wrote:
> 
> Hi Luc,
> 
> I agree it would be great if BibDesk could at least give us the option.
> 
> BibDesk already has an Orphaned Files feature that you can use periodically 
> to remove the files you don't need anymore from your attachments directory.
> 
> Otherwise, I use the following script with the Remove File hook to do just 
> what you desire:
> 
> using terms from application "BibDesk"
> on perform BibDesk action with publications thePubs for script hook 
> theScriptHook
> tell application "BibDesk"
> set theField to get field name of theScriptHook
> set oldValues to get old values of theScriptHook
> if theField = "Local File" then
> repeat with theFile in oldValues
> set theAlertText to "File association removed."
> set theAlertMessage to "You are detaching the file \"" & 
> theFile & "\" from the corresponding publication. Would you like to delete 
> the file from the file system as well?"
> set result to display alert theAlertText message 
> theAlertMessage as critical buttons {"Keep", "Remove"} default button 
> "Remove" cancel button "Keep"
> if button returned of result = "Remove" then
> tell application "Finder" to delete theFile as POSIX 
> file
> end if
> end repeat
> end if
> end tell
> end perform BibDesk action with publications
> end using terms from
> 
> 
> Hope this helps,
> Mahmood
> On 12 Jun 2020, 11:05 +0200, Fischlin Andreas , 
> wrote:
>> Dear Luc,
>> 
>> Indeed, that would be annoying.
>> 
>> BTW, I offer on my website several AppleScripts which greatly support such 
>> tasks. E.g. I can simply replace in the Finder an obsolete version of a PDF 
>> with an updated one and then trigger with a shortcut (Ctrl^F) an AppleScript 
>> that discards the old link and replaces it with a new link to the new file. 
>> There is only one drawback for this to work, I use information from the 
>> record to construct the file name. In my case I use only the cite key with 
>> some suffixes if there are several PDF’s linked to the same article, e.g. 
>> supplementary material, to name my PDFs.
>> 
>> Should you be interested, here the link: 
>> https://www.sysecol2.ethz.ch/software/ 
>> 
>> 
>> Regards, 
>> Andreas 
>> 
>> ETH Zurich
>> Prof. em. Dr. Andreas Fischlin
>> IPCC Vice-Chair WGII
>> Systems Ecology - Institute of Biogeochemistry and Pollutant Dynamics
>> CHN E 24
>> Universitaetstrasse 16
>> 8092 Zurich
>> SWITZERLAND
>> 
>> andreas.fisch...@env.ethz.ch 
>> www.sysecol.ethz.ch/people/andreas.fischlin.hml 
>> 
>> 
>> +41 44 633-6090 phone
>> +41 44 633-1136 fax
>> +41 79 595-4050 mobile
>> 
>>  Make it as simple as possible, but distrust it!
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> On 12/06/2020, at 09:31, Luc Bourhis via Bibdesk-users 
>>> >> > wrote:
>>> 
>>> Hi,
>>> 
>>> it would be sweet if BibDesk would propose to remove the actual file on 
>>> disk when one removes a link from a record. It happens every now and then 
>>> that either I filed the wrong file, or more often that I want to replace a 
>>> preprint by a later version or the published one. Currently, I have to 
>>> remove the link, add the new one, then use “Reveal in Finder” and remove 
>>> the old one. A bit tedious.
>>> 
>>> Best wishes,
>>> 
>>> Luc J Bourhis
>>> 

___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Mahmood Shafeie Zargar
Hi Luc,

I agree it would be great if BibDesk could at least give us the option.

BibDesk already has an Orphaned Files feature that you can use periodically to 
remove the files you don't need anymore from your attachments directory.

Otherwise, I use the following script with the Remove File hook to do just what 
you desire:

using terms from application "BibDesk"
    on perform BibDesk action with publications thePubs for script hook 
theScriptHook
        tell application "BibDesk"
            set theField to get field name of theScriptHook
            set oldValues to get old values of theScriptHook
            if theField = "Local File" then
                repeat with theFile in oldValues
                    set theAlertText to "File association removed."
                    set theAlertMessage to "You are detaching the file \"" & 
theFile & "\" from the corresponding publication. Would you like to delete the 
file from the file system as well?"
                    set result to display alert theAlertText message 
theAlertMessage as critical buttons {"Keep", "Remove"} default button "Remove" 
cancel button "Keep"
                    if button returned of result = "Remove" then
                        tell application "Finder" to delete theFile as POSIX 
file
                    end if
                end repeat
            end if
        end tell
    end perform BibDesk action with publications
end using terms from


Hope this helps,
Mahmood
On 12 Jun 2020, 11:05 +0200, Fischlin Andreas , 
wrote:
> Dear Luc,
>
> Indeed, that would be annoying.
>
> BTW, I offer on my website several AppleScripts which greatly support such 
> tasks. E.g. I can simply replace in the Finder an obsolete version of a PDF 
> with an updated one and then trigger with a shortcut (Ctrl^F) an AppleScript 
> that discards the old link and replaces it with a new link to the new file. 
> There is only one drawback for this to work, I use information from the 
> record to construct the file name. In my case I use only the cite key with 
> some suffixes if there are several PDF’s linked to the same article, e.g. 
> supplementary material, to name my PDFs.
>
> Should you be interested, here the link: 
> https://www.sysecol2.ethz.ch/software/
>
> Regards,
> Andreas
>
> ETH Zurich
> Prof. em. Dr. Andreas Fischlin
> IPCC Vice-Chair WGII
> Systems Ecology - Institute of Biogeochemistry and Pollutant Dynamics
> CHN E 24
> Universitaetstrasse 16
> 8092 Zurich
> SWITZERLAND
>
> andreas.fisch...@env.ethz.ch
> www.sysecol.ethz.ch/people/andreas.fischlin.hml
>
> +41 44 633-6090 phone
> +41 44 633-1136 fax
> +41 79 595-4050 mobile
>
>              Make it as simple as possible, but distrust it!
> 
>
>
>
>
>
>
> > On 12/06/2020, at 09:31, Luc Bourhis via Bibdesk-users 
> >  wrote:
> >
> > Hi,
> >
> > it would be sweet if BibDesk would propose to remove the actual file on 
> > disk when one removes a link from a record. It happens every now and then 
> > that either I filed the wrong file, or more often that I want to replace a 
> > preprint by a later version or the published one. Currently, I have to 
> > remove the link, add the new one, then use “Reveal in Finder” and remove 
> > the old one. A bit tedious.
> >
> > Best wishes,
> >
> > Luc J Bourhis
> >
> >
> >
> > ___
> > Bibdesk-users mailing list
> > Bibdesk-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/bibdesk-users
>
> ___
> Bibdesk-users mailing list
> Bibdesk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bibdesk-users
___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Christiaan Hofman


> On 12 Jun 2020, at 09:31, Luc Bourhis via Bibdesk-users 
>  wrote:
> 
> Hi,
> 
> it would be sweet if BibDesk would propose to remove the actual file on disk 
> when one removes a link from a record. It happens every now and then that 
> either I filed the wrong file, or more often that I want to replace a 
> preprint by a later version or the published one. Currently, I have to remove 
> the link, add the new one, then use “Reveal in Finder” and remove the old 
> one. A bit tedious.
> 
> Best wishes,
> 
> Luc J Bourhis
> 


I now realized that you can in fact already do this. Go to the General 
preference and check the last item.

Christiaan

___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Fischlin Andreas
Dear Luc,

Indeed, that would be annoying.

BTW, I offer on my website several AppleScripts which greatly support such 
tasks. E.g. I can simply replace in the Finder an obsolete version of a PDF 
with an updated one and then trigger with a shortcut (Ctrl^F) an AppleScript 
that discards the old link and replaces it with a new link to the new file. 
There is only one drawback for this to work, I use information from the record 
to construct the file name. In my case I use only the cite key with some 
suffixes if there are several PDF’s linked to the same article, e.g. 
supplementary material, to name my PDFs.

Should you be interested, here the link: https://www.sysecol2.ethz.ch/software/

Regards,
Andreas

ETH Zurich
Prof. em. Dr. Andreas Fischlin
IPCC Vice-Chair WGII
Systems Ecology - Institute of Biogeochemistry and Pollutant Dynamics
CHN E 24
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

andreas.fisch...@env.ethz.ch
www.sysecol.ethz.ch/people/andreas.fischlin.hml

+41 44 633-6090 phone
+41 44 633-1136 fax
+41 79 595-4050 mobile

 Make it as simple as possible, but distrust it!







On 12/06/2020, at 09:31, Luc Bourhis via Bibdesk-users 
mailto:bibdesk-users@lists.sourceforge.net>>
 wrote:

Hi,

it would be sweet if BibDesk would propose to remove the actual file on disk 
when one removes a link from a record. It happens every now and then that 
either I filed the wrong file, or more often that I want to replace a preprint 
by a later version or the published one. Currently, I have to remove the link, 
add the new one, then use “Reveal in Finder” and remove the old one. A bit 
tedious.

Best wishes,

Luc J Bourhis



___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users

___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


Re: [Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Christiaan Hofman
You should use the contextual menu for this. We should definitely not do
this automatically, this would be very annoying for most users.

Christiaan
___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users


[Bibdesk-users] Feature request: remove file on disk when removing link

2020-06-12 Thread Luc Bourhis via Bibdesk-users
Hi,

it would be sweet if BibDesk would propose to remove the actual file on disk 
when one removes a link from a record. It happens every now and then that 
either I filed the wrong file, or more often that I want to replace a preprint 
by a later version or the published one. Currently, I have to remove the link, 
add the new one, then use “Reveal in Finder” and remove the old one. A bit 
tedious.

Best wishes,

Luc J Bourhis



___
Bibdesk-users mailing list
Bibdesk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-users