Jump to content

How to take text input from user?


Recommended Posts

Hi everyone,

 

I am building a workflow where I want to take 2 inputs from the user, one after the other. How can I do that? I searched a bit and found apple script can display an input dialog box, but with only one input field. Plus, there are certain limitations to things I can do in AS and prefer not to use it.

 

Is there another way I can take two inputs consecutively from the user? I was thinking of using script filter like:

- Trigger script filter 1

- Take first input 1

- Pass it to next script filter

- Send it for further processing.

 

But this seems too complicated. Any easier way to achieve this @deanishe?

 

Link to comment
54 minutes ago, andy4222 said:

But this seems too complicated.

 

That's the normal way to do it. You store the result of the first Script Filter in a variable for later.

 

Look at the "Simple To-Do List" example workflow included with Alfred.

Link to comment

Why do you need two Script Filters? Why do you need Script Filters at all? You considered using AppleScript dialogs to requests the input, so it sounds like two Keyword Inputs would suffice and be simpler. While we’re at it, why two? Depending on the input, you may just get them both in one go if you separate them with a comma, or a space, or another character and split it right after, either in your code or with a utility.

Link to comment
  • 2 weeks later...

@deanishe I was able to make this work with 2 script filters, but for some reason, when the workflow finishes the text processing and pastes the text, it always inserts a new line at the end (cursor goes to the next line). I want the cursor to remain on the same line (unless the actual text output contains new line). 

 

e.g.

Input (selected just the text without the new line):

Quote

convert this

 

 

output (UPPER CASE TEXT PROCESSOR):

Quote

 

CONVERT THIS

{cursor is here}

 

 

 

Workflow: https://www.dropbox.com/s/fcocudpog6eeoy7/Remove Newlines.alfredworkflow?dl=0

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