Getting User Input

bumcheekcity

Active member
Is there any way to get arbitrary user input in the form of a string rather than a boolean in the middle of thread execution? It would be useful for a new project, and I feel I'm missing something on the wiki.

I know user_confim returns a boolean, but I'd like a user_string() or user_input() or something.
 

xKiv

Active member
I think the closest goes like this:
write a script with main(string s) { stuff s into a preference }
call it from your ash as "cli_execute("script_name")" (without argument)
retrieve preference
 

StDoodle

Minion
Not in the middle of execution; there are various ways to handle pre-script setup, but once the script starts running, only boolean values can easily be captured.

Though, it does give me a curious thought; if you execute the script as a relay script (either info or override should work), you could have it stop, then at the end query the user for info, and have them submit the relay page with such info and then the script could "resume" (actually it would be starting over, but you could script ways to make that a semantic difference only). But I don't think there's much you can do on the gCLI.

Edit to add some background:

This conversation actually came up before, as to requesting additional user_X() functions, and indeed I once pushed for it. The basics are that even user_confirm() can be easily abused, and cause aggravation to the user, as having to provide ongoing input kinda defeats the purpose of running scripts. The existence of user_confirm() was considered a bit of a "necessary evil" just in case a script might do something unexpected that could cause real problems. When I last pestered the devs about additional user-input, we were given htmlform (and there was much rejoicing).
 
Last edited:

Bale

Minion
Is there any way to get arbitrary user input in the form of a string rather than a boolean in the middle of thread execution? It would be useful for a new project, and I feel I'm missing something on the wiki.

I know user_confim returns a boolean, but I'd like a user_string() or user_input() or something.

It can be done just as xKiv suggests. Honestly though, relay scripts are much better for providing user input.
 

StDoodle

Minion
If you want to provide more of a "hint" as to the project, someone may have an alternative that could work for the specific situation. :)
 

bumcheekcity

Active member
It's OK, I've incorporated it into bUMRATS, which I'm going to focus more on over the coming months.

Also, it's not fantastically interesting :p
 

Donavin69

Member
Since you can ask at script execution, couldn't you simply call the script you want to get input for, from a 'master' script, exit the 'child' script whenever you need user input?
 

Bale

Minion
Since you can ask at script execution, couldn't you simply call the script you want to get input for, from a 'master' script, exit the 'child' script whenever you need user input?

That is what xKiv suggested in post #2.
 

Donavin69

Member
I misunderstood what you were all saying....

Sorry...I couldn't believe that something like that wouldn't work...

I can see times that this would be more useful than a relay script (it isn't always the same)
 
Top