ghui Posted January 5, 2017 Share Posted January 5, 2017 Details: I'm developing a workflow which need a API_TOKEN to get data from a third-party website. What I want is give an obvious notification (something like a dialog with a edittext in it) to the user, Let them enter the API_TOKEN in the dialog directly. Is it possiable? Sorry for my poor english skill! Hope you guys can got it! Thanks in advance! Link to comment
Andrew Posted January 5, 2017 Share Posted January 5, 2017 @ghui if you fill in the "About this Workflow" field under the [x] button to the top right of the workflow config, this is shown when the user installs the workflow. If you set the token as a variable in there, this is a good place for the user to set it too, then you can use that variable in your workflow Cheers, Andrew Link to comment
ghui Posted January 5, 2017 Author Share Posted January 5, 2017 (edited) @Andrew Thanks firstly, The panel 'About this Workflow' showed when a workflow installed, But the 'Workflow Environment Variables' panel doesn't show. I guess you mean set the token to the 'workflow environment variables' panel. For more detail see the image, please Edited January 5, 2017 by ghui more details Link to comment
Andrew Posted January 5, 2017 Share Posted January 5, 2017 @ghui there is no way at this point to automatically show variables which need filling. The best thing to do for now is put some info in the "About this Workflow" section to say something along the lines of: "Set your API token in the variables panel". I'll add a note to have a think about "required variables" for a future release of Alfred Cheers, Andrew ghui 1 Link to comment
ghui Posted January 5, 2017 Author Share Posted January 5, 2017 I'm looking forward to the feature, It will be very convenient to the user. Thanks again for your rapid response. Link to comment
juliosecco Posted January 5, 2017 Share Posted January 5, 2017 (edited) Well, I think there could be a solution, but a little tricky to implement. Using Applescript you could be able to display a dialog to the user and accept an input, then you could use the value to override the workflow environment variables. obviously that will not work at installation time, but at the first launch, after you control the missing value here you have a startup: place on your workflow an osascript AS object, and paste this code: on run argv set theName to the text returned of (display dialog "What is your name?" default answer "") end run running it you will have a dialog appear, asking the user for input if you link a 'post notification' object after that, you will se what the user has entered (I think the AS output is simply the last variable set, theName in this case) I'm quite sure that also in Javascript, if used as OSAscript, you can display a dialog, if you feel more comfortable with javascript... once obtained the value, you should be able to set it as workflow variable: https://www.alfredapp.com/help/workflows/advanced/variables/ hope this helps a bit, Giulio Edited January 5, 2017 by juliosecco Link to comment
dfay Posted January 5, 2017 Share Posted January 5, 2017 Another option is to have the user run a separate configuration workflow - see for an example ghui 1 Link to comment
ghui Posted January 6, 2017 Author Share Posted January 6, 2017 @dfayThat's what I had did, but I think it isn't enough convenient for a newbie, That's why I posted this question. Thanks all the same! Link to comment
ghui Posted January 6, 2017 Author Share Posted January 6, 2017 @juliosecco That's great, I'll try it. Thanks! 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