Jump to content

Chaining keywords to produce a string to be entered into the active textbox?


Recommended Posts

I'm fed up of typing my new startup's domain name whether it be as part of an e-mail address, site address or jut the name.  I've typed it incorrectly  few times which has caused issues.  Its not the hardest but when you're working as hard/quickly as I am the moment it'd easy to mix connectables with changeable and others that my sub-conscious has been tricking me with.

 

It doesn't help that I cut through some tendons in my left hand about 8 weeks ago.  I've only just been told I can take the split off and use for light operations only.  They've operated twice already, its thrown my typing out completely.

 

So I'd like to open Alfred (I doubt tap alt on my MacBook Air which is my main machine and leave the defaults on the others when I screen share with them) type sc [name|mail|site| [io|com|co.uk] so for example sc mail io would yield xyz@somewhere.io or sc name io yields somewhere@io.  With regards to sc site com I'd want it to launch the default browser at https://somewhere.com which I know is easy enough.  Hmmmm... might as well add a send keyword too and open Google Inbox and see if I can somehow trigger a new message window and pre-populate the address.  Might leave that part for a rainy day.

 

So can I chain keywords.  I've created a work flow and put two in but can't connect then together.  And then how do I put the result into the active text box?  The doesn't look like an Output which can do that.

 

 

 

Thanks,

Lee.

 

PS I did do it as a bash script first but its slow, requires terminal to be launched or running etc etc.

Edited by Lee
Link to comment

Turns out to be pretty simple and quick.  A keyword, in the proof of concept named sc name io connected to an NSAppleScript consisting of the following.   Boom!

 

on alfred_script(q)

 
    tell application "System Events" to keystroke "example.io"
 
end alfred_script
 
Shame its not going to work on my Windows VM, that runs on one the screens.
Link to comment

Ok to make it perfect upon typing sc name io poor old (but super awesome and my new favourite thing despite it being I either the first or second application I bought for my first Mac about 10 years ago) I want it to close by itself i.e. without me having to press enter.  Can this be done?

Link to comment

HAHA! It works in the RDP Windows VM too :)  I was going to write a C# app that listened on a port for a command such as 'set text {value}' and send the notification to there.

 

So the only remaining question is can I have Alfred dismiss itself automatically once I've entered the full keyword(s)?

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...