Jump to content
Simzdk

Alfred as Text Expander

Recommended Posts

Hi

Just wondering if it will be possible to extend the use of "Copy to Clipboard" (Paste to front most app) to feature special keys like Return, Tab and such, and thereby making Alfred an awesome Text Expander? 

 

I have seem some workflows with scripts doing this, but would be nice build in. 

 

http://d.pr/i/vPrW

Share this post


Link to post
Share on other sites

Im looking for simple Text Expander functionality. Say I want to quickly fill out a address form on a webpage. I would focus the cursor in the first field, active Alfred, and Alfred would paste my name first, Tab to get to another field, paste test into that and so on. 

 

Tab works in Textmate but doesn't jump between html fields in a webpage. 

Share this post


Link to post
Share on other sites

At this point, this is fairly unlikely as this would get to depths comparable to Text Expander and would be complex enough to be its own app. You could have a play around with scripts but for now, I'll say unlikely. :)

Share this post


Link to post
Share on other sites

I use it daily. There must be some step that you are missing.

 

My use case:

1. Create the keyword. For this example, we'll say I'm creating one for my name. So I would set the keyword to be ',df'.

2. Create the Copy to Clipboard output item. Set the data to be copied to be 'David Ferguson'. Set the option to paste to front app.

3. Connect the keyword to the copy to clipboard output.

4. Go to web, apps, etc

5. Cmd+Space to pop up Alfred

6. Type ',df' and press Enter.

 

I used this exact method to expand ',df' into 'David Ferguson' above, and right here. So it works in browsers/in forms.

Share this post


Link to post
Share on other sites

And by using the tab key in the paste field, you can get Alfred to jump between two input text field in a html page? I cant seem to get that working. 

If I use the workflow in a pure text field like this, I can see the tab in the text, but it doesnt read as a tab (special key) so it wont jump fields. 

Share this post


Link to post
Share on other sites

What you're looking at doing is using Alfred as a form filler and not a text expansion. These are completely different. Also, something like that is going to be something that is a little more difficult to do because of the fact that web forms are so different. Some have name and email only, some have name, email, address (with 1, 2, or 3 lines), city, state, etc. You CAN do this, but it has the potentially to be wildly inaccurate because of changing forms. To do it would require the use of AppleScript and not using the clipboard. You would have to simulate keystrokes with AppleScript, telling it to keystroke "text", keystroke "Tab", keystroke "text", etc.

Share this post


Link to post
Share on other sites

I use it daily. There must be some step that you are missing.

 

My use case:

1. Create the keyword. For this example, we'll say I'm creating one for my name. So I would set the keyword to be ',df'.

2. Create the Copy to Clipboard output item. Set the data to be copied to be 'David Ferguson'. Set the option to paste to front app.

3. Connect the keyword to the copy to clipboard output.

4. Go to web, apps, etc

5. Cmd+Space to pop up Alfred

6. Type ',df' and press Enter.

 

I used this exact method to expand ',df' into 'David Ferguson' above, and right here. So it works in browsers/in forms.

 

Thanks for this David - it works great and I now think I'll give Typeit4Me the flick and have one less app to load and take space in the menubar. Regarding your comment about not being a solution as a form filler - I suppose there's also no way to auto insert the date or time (e.g. dt, tm) as with the purpose built text expanders?

 

Thanks 

Share this post


Link to post
Share on other sites

Hi David Ferguson, 

 

Isn't it too much work setting up text expansions inside workflows? I prefer to use the clipboard snippets built-in feature: It works the same way, it's faster to create a snippet, it lets you set a keyword to do the expansion, and it has a separate keyboard shortcut - so your keywords don't conflict with the rest of the stuff, and you don't even need to set a prefix, like "," before the expansion. :)

 

I only see the need for a workflow if there is some kind of processing involved, like settings arguments or so

Edited by thiagoaraujos

Share this post


Link to post
Share on other sites

Hi David Ferguson, 

 

Isn't it too much work setting up text expansions inside workflows? I prefer to use the clipboard snippets built-in feature: It works the same way, it's faster to create a snippet, it lets you set a keyword to do the expansion, and it has a separate keyboard shortcut - so your keywords don't conflict with the rest of the stuff, and you don't even need to set a prefix, like "," before the expansion. :)

 

I only see the need for a workflow if there is some kind of processing involved, like settings arguments or so

 

Snippets do indeed work just as well. The only reason that I personally chose Workflows over snippets was because of the additional space required to use a snippet. For example, with snippets the usage to expand my name would be (by default) '; df'. Notice the space between. I moved from DashExpander and TextExpander and was used to something more like ',df', without the space. Workflows allowed me to do that. So yeah, snippets do it and are probably better suited for it, it was all just a personal preference. And I think at the time I started setting that up and playing with it, I'm wanting to say that snippets and the clipboard history for Alfred 2 had not been finished yet :)

Share this post


Link to post
Share on other sites

I have a file with abbreviation and desired expansions, for example for may LaTeX documents. I have it in Textmate and In there I can expand using this list. Do you think it is possible to make alfrd to read a list like this:

 

;a  \alpha

;b  \beta 

;thm  \begin{theorem} %| \end{theorem}

... ? 

 

and not to have to do every single abbreviation by hand?

 

For example I can export my TextExpander snippets in to a single document (a list). It would be perfect If I can just make Alfred to use the list to expand my snippets. 

Edited by Yoyontzin

Share this post


Link to post
Share on other sites

Going back to the original point of inserting ⇥, ↩, and others, it is fairly easy with applescript. Take into account, however, this will be like pressing the keys without any checking, so it can lead to undesirable results.

As an example, if you want to fill your first name, press ⇥ to go to the next field, and fill in your last name, you could have a Run Script node using /usr/bin/osascript as the language, and write something like

tell application "System Events"
  keystroke "<your_first_name>"
  key code 48
  keystroke "<your_last_name>"
end tell

key code 48 is ⇥, naturally. Something like Key Codes will help you find other codes you might need.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...