Jump to content

Separate output for scripts and clipboard actions


Recommended Posts

Hello,

 

Is there anyway to access the title value from the Copy to Clipboard task?

 

My results look like this:

<items>
  <item arg="/Users/chad/logins.txt:77">
    <title>alfredforums.com login: chadv</title>
    <subtitle>Open file.txt at line 77</subtitle>
  </item>
  <item arg="/Users/chad/logins.txt:99">
    <title>othersite.com login: chad</title>
    <subtitle>Open file.txt at line 99</subtitle>
  </item>
</items>

My primary action is an applescript that handles opening the file and selecting the line specified. I want to make a secondary action, accessible via modifier key, that copies the title value to the clipboard.

 

If this isn't possible natively, I can work around it with a script, but I wanted to ask first.

 

(EDIT: My original post was longer and rambling, I've reduced it for clarity.)

Edited by chadv
Link to comment

This description is really confusing, so maybe my response is off, but why not use the same script that opens text edit and selects the line # to also copy the title to the clipboard using Applescript's set the clipboard to ?

Link to comment

This description is really confusing, so maybe my response is off, but why not use the same script that opens text edit and selects the line # to also copy the title to the clipboard using Applescript's set the clipboard to ?

Thanks for your sugesstion, dfay. I'll probably wind up doing something like this, but using command line tools instead of Applescript and TextEdit.

 

I'm going to try to simplify my question to make it a little more clear what I'm looking for.

Edited by chadv
Link to comment

You can look into pbcopy / pbpaste from the command line. Otherwise, a not so elegant solution would be to split the output and run the argument through two different scripts, one that does the output and the other that copies the title (via the copy to clipboard workflow action).

Link to comment
If I've understood you correctly, you want to pass two different values to two different actions at the same time.

 

Alfred can't do that natively, so you can either bundle both your values together in arg and split them again afterwards or save one of the values to a temporary file and read it back from there.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...