mejayd Posted January 24, 2019 Share Posted January 24, 2019 Hi All, Brand new to Alfred as of today and I'm working on moving my snippets from TextExpander over to Alfred. I had a few of my text expander snippets where I would have it use the tab key to fill in web forms. From what I can see in Alfred this would have to be done via a workflow, but I can't seem to find a way to have it tab, paste something, tab again. For example I have a web form that asks for Name, email, and phone number. So doing this on my keyboard would be done as follows: John Doe {tab} John.Doe@company.com {tab} 6161215555 Is there a way to do this in Alfred either in the snippets or in a workflow? Bonus points if you can tell me how to paste a snippet in those fields. (I have snippets set up for my email and phone number and would like to be able to link directly to the snippet if possible. Link to comment
mejayd Posted January 24, 2019 Author Share Posted January 24, 2019 Note I did find this discussion from 2016, but was hoping there is an update since then that may address this: Link to comment
mejayd Posted January 25, 2019 Author Share Posted January 25, 2019 So I did somewhat figure out how to do what I want to do, but would like to know if this is the best way to do this. (see attached photo) I found I did have to add a delay so that the "pasting to the front most app" would happen before the key command. Is that expected? Link to comment
deanishe Posted January 25, 2019 Share Posted January 25, 2019 1 hour ago, mejayd said: I found I did have to add a delay so that the "pasting to the front most app" would happen before the key command. Is that expected? Yeah, pretty much. Sending keypresses and pasting (it's the same thing) is asynchronous. Your script sends an event to another application via the OS, which adds it to the target app's event queue. Your script and the OS do not wait for the target app to handle one event before sending the next one. So for anything that takes actual time—tabbing, switching windows, activating a search box etc.—you usually need to insert a sufficient delay to give the target app a chance to complete the previous action so the following keystrokes/clicks are sent to the correct widget or window. That's why this is a last-resort method of automating your system. A script that works perfectly on a lightly-loaded system can fail completely when the same system is under load and not responding as quickly. And what works on one machine doesn't work on a slower one. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now