|Index > Scribe > From script, how do I prompt user for an integer?
|From script, how do I prompt user for an integer?
|I've written a script to archive / delete mail recursively from a folder.
It works nicely apart from having hard-coded constraints for the filter.
Ideally, a GUI would pop up which would allow the user to select the various parameters such as duration and whether to delete or archive and where to archive.
For now, though, I'd settle for being able to prompt the user for the duration in years. I could write a Python script to create a GUI and then output the settings as a string. But I don't see any way to convert strings to integer.
How do I convert a user inputted string to an integer?
|The syntax for that is as follows:
str = "123"; myInt = str.int;
This is far from universal though, it works for 'int' and 'double' and only on string variants. You can't for instance do the opposite and use myInt.string to convert back to string. An oversight for sure.
There is an 'ICast' instruction that seems to be what we want here, but I can't remember the syntax to get the compiler to use it. Although it seems to support all the available types.
|I've added handling for 'int', 'string' and 'double' to inter-convert between those types.
so these work: