Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 30th, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Rewriting MacTypes::FileURL from appscript-ruby to MacRuby ScriptingBridge
  2. BibDesk = Appscript.app('BibDesk')
  3. selection = BibDesk.document.selection.get[0]
  4. f = MacTypes::FileURL.path(curfile)
  5. selection[0].linked_files.add(f,{:to =>Selection[0]})
  6. selection[0].auto_file
  7.        
  8. framework 'Cocoa'
  9. framework 'ScriptingBridge'
  10.  
  11. file=NSURL.fileURLWithPath("file:///Users/Stian/Downloads/Telearn.pdf")
  12. dt=SBApplication.applicationWithBundleIdentifier("edu.ucsd.cs.mmccrack.bibdesk")
  13. d= dt.documents[0].selection[0]
  14. d.linkedFiles.add(file,[:to=>dt.documents[0].selection[0]])
  15.        
  16. 84829 abort      macruby attach_bibdesk.rb
  17.        
  18. framework 'Cocoa'
  19.  framework 'ScriptingBridge'
  20.  
  21.  file_path = NSURL.fileURLWithPath("/Users/Stian/Downloads/Telearn.pdf")
  22.  bib_desk = SBApplication.applicationWithBundleIdentifier("edu.ucsd.cs.mmccrack.bibdesk")
  23.  selected_doc = bib_desk.documents.first.selection.first
  24.  bib_desk.add(file_path, to:selected_doc)