[Ja...] Posted Monday at 09:46 AM Share Posted Monday at 09:46 AM Hi, I'd like to change how operator names are entered in our program. Currently, we use inquireText to let users type in their name, but this allows them to enter anything. I'd prefer to offer a selectable list of names instead. I know I can use something like: inquireList("Operator:", "Arnold", "Bob", "Charlie", "Derek") However, I want the list to be dynamic. Ideally, I'd like to include an "Other" option. If the user selects this, it should: Prompt with inquireText for their full name Use addToFile() to save this name to a .txt file Add that name to the list for next time This way, the list grows as new users are added, and the file also serves as a log of who has used the program or CMM. The part I’m stuck on is using the list from the .txt file as input to inquireList. I’ve tried using list() but it seems to treat the entire list as a single option, not separate names. So I think I need a way to: Read the file into a list Count the names Use those names individually as arguments for inquireList If "Other" is selected, add the resulting text to the .txt for next time Any help on how to do this would be appreciated. Thanks in advance! Link to comment Share on other sites More sharing options...
[Er...] Posted Monday at 11:47 AM Share Posted Monday at 11:47 AM (edited) Here is a simpel example to push you forward.. savedOps = readListFile("c:\temp\operators.txt").sorted opList = "inquireList(" + qm() + "Operator:" + qm() + ", " + qm() + getParameterNamed(savedOps,1) + qm() for i = 2 to savedOps.size opList = opList + ", " + qm() + getParameterNamed(savedOps,i) + qm() next i repeat choise = compute(opList + ", " + qm() + "Other" + qm() + chr(41)) until choise <> "" if choise == "Other" newOp = inquireText("Add operator:") addToFile("c:\temp\operators.txt",newOp) choise = newOp endif setRecordHead("operid",choise) Edited Monday at 11:49 AM 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in