Jump to content

schoeps

Member
  • Posts

    53
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by schoeps

  1. Could you post the before and after of line 96, so that I can see exactly what needs to be changed, and hopefully can see why.

                     

    Sure. I guess Yosemite stores paths differently....

    if 'pdf' in source:    
        if not 'http' in source:
            clean_file = urllib.unquote(source)
            _file = clean_file.replace('file://', '')
            if os.path.isfile(_file):
                subprocess.Popen(
                    ['open', _file], 
                    shell=False, 
                    stdout=subprocess.PIPE)
  2. As to the error, there appears to be something wrong with your BibDesk cache files. They ought to be byte plist files. The error comes from the byte plist parser. I'm not certain what the problem is yet, I just got that error, but then it went away (all I did was change one thing in BibDesk then save). I will investigate.
    Thanks. I deleted my bibdesk cache and recreated it; now it's working. Your parsing seems to be more sensible than my approach (but it seems to be faster too...).  
     

    what do you mean by "bibtype"? If you mean publication type, that's what the different icons represent.

     

     

     

    the icons are really nice and some meanings are obvious but some are not so clear. Furthermore there are probably more types than icons ("electronic", "misc" and unpublished",...). I don't know about others but I use all of them. However it's probably easy to modify your workflow to do that.

     

     

    I might add a config file, but I don't plan on changing the default. It's simple enough to alter in the code anyway.

    yes, see above.

     

     

    I'm working on a number of things in this regard currently...
    with bibdesk it's not too difficult as you might have seen. Alternatives are other external parsing engines (bibtex2html...) but this seemed to be overkill for me.
  3. That is good news! Now, we know that spaces in file names seem to be the bad guys (I would never have found this issue because I use the bibkeys as filenames). I will have look to it! 

     

    Problem seems to be solved I had to convert from URL encoding. Now I use PHP for that

    set thePOSIXfile to do shell script "php -r \"echo rawurldecode('" & theURL & "');\""
    

    Please test it: BibDesk_Search_beta.alfredworkflow

  4. Hi stephen, 

     

    first, your workflow looks great and judging on its complexity it seems that it requires more time than I can afford for bibsearch. Hence I am very pragmatic and once your feature set is greater than bibsearch's, I will most probably stop maintaining bibsearch. In particular because my time does hardly allow it.

     

    Let me give some general remarks:

    • it would be nice to display the bibtype because there might be preprints and papers with the same name, date and authors in your database
    • users asked me to display the year before the authors list because it might be very long (e.g. in medicine or physics, ..) and then the date information is not shown
    • I think for many users it is convenient to copy a complete citation string of a publication, e.g. if they have to work with MS Word and they want to add a single reference in some footnote. This is ongoing work in bibsearch. However, you can take whatever I have added there.

     

    However, I tried it today and I got the following error 

    Starting debug for 'BibQuery'
    
    
    [ERROR: alfred.workflow.input.scriptfilter] Code 1: 09:44:22 workflow.py:1199 ERROR    Bad file header
    Traceback (most recent call last):
      File "/Users/xxx/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.CF861A51-8CB7-4408-93CA-D51684C77953/workflow/workflow.py", line 1197, in run
        func(self)
      File "bibquery.py", line 442, in main
        filter(queries, scope, wf)
      File "bibquery.py", line 420, in filter
        simple_filter(query, scope, wf)
      File "bibquery.py", line 310, in simple_filter
        data = read_cachedir()
      File "bibquery.py", line 83, in read_cachedir
        bib_data = ccl_bplist.load(_file)
      File "/Users/xxx/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.CF861A51-8CB7-4408-93CA-D51684C77953/ccl_bplist.py", line 258, in load
        raise BplistError("Bad file header")
    BplistError: Bad file header
  5. set f to "Dragonfly:Users:somebody:Documents:unruh%202014%20evidencing%20the%20resti.pdf"

    tell application "Finder" to reveal f
     
    gives the same error message.

     

    That is good news! Now, we know that spaces in file names seem to be the bad guys (I would never have found this issue because I use the bibkeys as filenames). I will have look to it! 

  6. Hmm...I installed this and now Alfred displays the message

     

    Incompatible Workflow

    This workflow was created with a newer version of Alfred

    Please upgrade Alfred to the latest version (or pre-release) to use this workflow

     

    I am running Alfred 2.2 b243 which is the newest....I can't find a link to download a newer Alfred beta.

     

    The old version seems to be active, though, or the new one has issues - return, shift and alt options work; cmd and ctrl don't.

     

    Can you try the workflow with the latest pre-release alfred? Thanks!

  7. The path isn't the issue.  The error message in the copy to clipboard script is because there's a hard-coded template name "abbrvTemplate" which isn't one of the BibDesk defaults.  

    Thanks! I have created a new beta version (BibDesk_Search_beta.alfredworkflow) that now includes its own Bibdesk template. Can you please try it? 

     

    I have also corrected the readme:

    You can use the following actions:
    - [return] to open in Bibdesk
    - [cmd]+[return] to reveal attached pdf in finder
    - [alt]+[return] to open attached pdf in your favorite viewer
    - [shift]+[return] to copy the citekey to clipboard 
    - [ctrl]+[return] to copy a citation string
  8. As you may have guessed, the scripts are working fine on my computer. Thus we have to debug it together... I have uploaded a debug build here: BibDesk_Search_debug.alfredworkflow

    It should show dialogs with the path to the entry selected in Alfred. 

     

    Let's have a look at the more difficult case, i.e., what happens if you press ^↩. For this we analyze the Applescript.
    Can you copy the following into the Applescript editor and adapt q to contain the path to your bdskfile? What happens if you run it? 

    set q to "/Users/????/Library/Caches/Metadata/edu.ucsd.cs.mmccrack.bibdesk/????.bdskcache"
    
    --remember active app
    tell application "System Events"
    set activeApp to name of first application process whose frontmost is true
    set process_bid to get the bundle identifier of process activeApp
    set activeApp to file of (application processes where bundle identifier is process_bid)
    set activeApp to activeApp as string
    end tell
    
    -- check whether BibDesk is ready
    tell application "BibDesk"
    activate
    if (count of documents) = 0 then
    beep
    display dialog "Please open your BibDesk database" buttons {"OK"} default button 1
    return
    end if
    end tell
    
    tell document 1 of application "BibDesk"
    set bibkey to do shell script "mdls -name net_sourceforge_bibdesk_citekey '" & q & "'| cut -d'\"' -f 2"
    set thePub to get publications whose cite key is bibkey
    set theResult to (templated text using "abbrvTemplate" for thePub)
    end tell
    
    tell application activeApp to activate
    return theResult
    
  9. I am getting a result like /Users/~/Library/Caches/Metadata/edu.ucsd.cs.mmccrack.bibdesk/Yimam2006.bdskcache when I try to copy

     

     

    There is a readme for each workflow, you can access it by double-clicking on the workflow icon within Alfred's preferences.

    Your question is hopefully answered there:

     

    BibDesk Search (Version 2.1)

     

    This workflow allows to search your Bibdesk library. It relies on Spotlight and Bibdesk, i.e., it finds only entries that are cached in the directory "~/Library/Caches/Metadata/edu.ucsd.cs.mmccrack.bibdesk/"

     

    You can use the following actions:

    - [return] to open in Bibdesk

    - [cmd]+[return] to copy the citekey to clipboard 

    - [shift]+[return] to open an attached pdf in your favorite viewer

    - [alt]+[return] to copy a citation string ("abbrvTemplate")

     

    The artwork is property of BibDesk.app (http://bibdesk.sourceforge.net) which is published under the BSD License.

     

  10. As expected, the copying does not preserve the formatting, but that is a limitation of AppleScript itself and doesn't bother me as I use character style templates in my documents anyways.

     

    I have made one minor modification. I added  ... As you can see, I also changed the name of the result from result to theResult - for some reason, it wouldnt't work otherwise with my changes. The idea behind these changes was to re-activate the formerly frontmost app after the clipboard was set. The activeApp part is somewhat complex to account for users who have different apps with the same name (I do because of Parallels).

     

    I have played around with 

    templated rich text

    in the applescript to preserve formatting but this seems not to work.

     

    However, I added your changes to "Beta 2": BibDesk_Search_beta2.alfredworkflow. Thanks!

    I will use this version a few more days and then update the main download link.

  11. Interesting, I want to use it but It would be very nice if after hitting the command. the image passes to clipboard or directly pasted to the most front app...  Do you think it is hard to do?

    I have tried but latexit does not support Applescript natively. There are sme workaround but before I can copy the image I need to determine when the rendering is done and this does not work. It seems impossible. Sorry. 

  12. Sebastian, thank you for  a great workflow.

     

    I have one feature suggestion - obviously, since I am unable to estimate how difficult this would be to implement, this is a mere suggestion. It would be great if one could set a default BibDesk template and then have one additional modifier which - provided the bib fiel containing the publication is open - copies the selected publication formatted according to the preset template to the clipboard. In essence, it would implement Bibdesk's "Copy using template" with a preset template.

    Great idea. I have set up a beta version. I hope that I have introduced no new bugs:

     

    https://bitbucket.org/schoeps/alfred/downloads/BibDesk_Search_beta.alfredworkflow

     

    If you press [CTRL]+[Enter] Alfred copies the publication string to the clipboard. I use the Bibdesk template "abbrvTemplate" for now but this can be changed easily. Please give feedback.

  13. The output is perfect and since the main work of the plugin is done exactly in this php script I is difficult to debug beyond this point. However, do you use Mavericks? I realized that search results come sometimes with some delay. I will try to find out why...

  14. You have a ".bib"-file somewhere that contains your library, right? Then you need to open it with bibdesk and then save it. The reason is that Bibdesk creates .bdskcache whenever it saves a bib-file. Afterwards they should be visible to Alfred.

     

    The folder does not exist. I only find ~/Library/Caches/edu.ucsd.cs.mmccrack.bibdesk/ containig no .bdskcache files at all.

     

    This might rather be a BibDesk problem?

    Thanks for your help!

  15. This still doen't work here. When I type "bib", Alfred offers me to "Search in BibDesk library", but as soon as I type the search argument, only the default search engines are displayed. Too bad, I'd really love to use this workflow...

    OK, let's try to find out what the problem is:

    1. what is the content of the directory 

    ~/Library/Caches/Metadata/edu.ucsd.cs.mmccrack.bibdesk/

    There should be plenty of files ("*.bdskchache").

     

    2. open terminal.app and go to the directory of the bibdesk plugin (you can find out the location by opening the workflow tab of the preferences, then right click on bibdesk workflow and click open in finder). Enter in terminal: 

    php search.php author

    What is the output?

  16. I do not have mavericks hence debugging is difficult for me but since you must be a developer to get 10.9, you can probably help me :) Just run the following code in the applescript editor (of course replace VPNCONNECTION with the correct string as given in the system preferences) and see what is happening...   

    tell application "System Events"
    	tell current location of network preferences
    		set VPNservice to service "VPNCONNECTION"
    		set isConnected to connected of current configuration of VPNservice
    		if isConnected then
    			disconnect VPNservice
    			set output to "Disonnected"
    		else
    			connect VPNservice
    			set output to "Connected"
    		end if
    	end tell
    end tell
    
  17. Hi,

     

    it should be fixed in 1.5, i.e., "bib xxx" searches the keys too. Maybe I will think in the future about specific keywords like "bibkey WimmerMayringerEtAl1999" to allow more precise search… well let's see :)

     

    Bye

    Seb.

      

    One little thing I miss, though, is the ability to search with an exact BibTeX key (e.g. "bib WimmerMayringerEtAl1999"). When I do this, the workflow does not recognize the entry. I use this often to go back from LaTeX to the cited article, i.e. select BibTeX key in \cite{} command, press Modifier to send text to Alfred (via Show Alfred with selection workflow), type in bib and jump to the file in BibDesk.

     

×
×
  • Create New...