Applescript for import from clipboard?

Hi,

I saw this applescript to integrate with Quicksilver in another thread:

tell application “EagleFiler”
set theURL to the clipboard
tell library document 1
import URLs {theURL}
end tell
end tell

I’d like to do the same to import articles from my newsreader (Shrook), but copying from the clipboard instead. It’s probably a very simple change to the applescript above. I tried importing using the Cmd-% shortcut, but it doesnt do anything.

Thanks!

That’s what that script does. It imports the URL that has been copied to the clipboard. Or am I misunderstanding you?

Command-% is for importing the selected text.

Actually, with EagleFiler 1.1 and later you don’t need this script. Just copy the URL and press the capture key, and if EagleFiler doesn’t know how to capture from the current application (e.g. Shrook) it will offer to import the clipboard for you.

Actually it was for importing any text on the clipboard, not just URLs. I managed to get CMD-% working though… I had to logout and login again, after installation. If its in the documentation, I hadnt noticed it.

Thanks!

At present, to do it with a script the script would need to save the text to a file and then tell EagleFiler to import the file.

I will make a note to add that. Thanks.

Quicksilver typing…EF appearing…
This would be really great. I haven’t really gotten my head around QS yet, but i can see that it would be really great to type a quick snippet and have it sent right to EF.

Is there anyway that the QS text could get written to the Unfiled folder?

Similarly, is it possible to get an “EF Inbox” where files could be submitted for EF to discover only on start-up? An inbox would make EF much more useful for users concerned about giving EF resources to run in the background and file materials when possibly that work could be delayed to a different work session.

Here’s a little script that will ask you for some text and then import it into EagleFiler.

display dialog "Enter some text to import into EagleFiler:" default answer ""
set theText to text returned of the result
set tempFolder to (path to temporary items)'s POSIX path
set tempFile to tempFolder & "Snippet.txt"
do shell script "echo " & theText's quoted form & " | cat > " & tempFile's quoted form
tell application "EagleFiler"
    tell library document 1
        import files {POSIX file tempFile}
    end tell
end tell

There may be a better way to do this, e.g. you could avoid “display dialog” if Quicksilver has a mechanism for asking you for the text.

Yes, that’s where everything is imported by default.

That’s a feature I’d like to add.

As of EagleFiler 1.1.2 you can import text directly via AppleScript, without first creating a temporary file. EagleFiler will set the title and filename based on the first line of the text. For example:

tell application "EagleFiler"
    tell library document 1
        import text "this is a test"
    end tell
end tell

Script to import text with QuickSilver:


using terms from application "Quicksilver"
  on process text ThisClipping
    try
      tell application "EagleFiler"
        tell library document 1
          import text ThisClipping
        end tell
      end tell
    end try
  end process text
end using terms from

Put the script in ~/Library/Application Support/Quicksilver/Actions/