How to Read Data from a File and Use in Dialog Box
Keywords: inireadpvt iniwritepvt
Question:
I need to be able to save txt entered from a dialog box to a file. So when the *.wbt is started again the txt will not have to be entered.I must be getting too old for all this. I just don't seem to understand how you get the dialog box and the "iniReadpvt or the iniWritepvt" to talk to one another HELP.
Are there any example scripts that uses the dialog boxs and saves the text entered to a *.ini file?
Answer:
When I need to do that, I generally write the data to an ini file using IniWritePvt.So on start up, I initialize the variables using IniReadPvt. It either gets the old value stored from a previous run in the ini file, or the default value specified in the iniReadPvt statement.
Here's an example:
;======================snip========================== inifile="WWW-PROD.INI" myeditbox=IniReadPvt("TEST","MYEDIT","<>",inifile) MyDialogFormat=`WWWDLGED,5.0` MyDialogCaption=`WIL Dialog` MyDialogX=16 MyDialogY=32 MyDialogWidth=88 MyDialogHeight=48 MyDialogNumControls=2 MyDialog01=`8,26,64,DEFAULT,PUSHBUTTON,DEFAULT,"OK",1` MyDialog02=`8,8,64,DEFAULT,EDITBOX,myeditbox,""` ButtonPushed=Dialog("MyDialog") IniWritePvt("TEST","MYEDIT",myeditbox,inifile) Message("Data entered was",myeditbox)
Article ID: W12855Filename: Reading Info from File and Displaying in Dialog.txt