Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help writing to file - Pass data from dialogue box

Status
Not open for further replies.

Solinus

Programmer
Apr 4, 2011
3
0
0
US
At my company, I've been tasked with cleaning up and streamlining our capture programs. I'm really new to Aspect so I hope you'll be patient with me.

Before our capture programs run, a dialogue box appears that asks for user input, mainly check boxes to determine what items are to be captured. In the past we've had to set our data path in the Connection Directory in the Miscellaneous field box (as well as some other fields in other places), and we'd read the directory in that way. I want to centralize everything on this dialogue box so that there's very little extra steps needed. I think I've figured out mostly how I want/need to do some things. The issue I'm having the most trouble with is how to pass input from the dialogue box and pass it to a text file. I want to do this so it's essentially a config/settings file. I'm pretty sure that I'm aware how to read from the file once it's written (ie to set connection directory information, etc.) but how to get it into the file, I have no idea.

The other obstacle once the file is created, the next time I try to run the program, I want the dialogue boxes to populate with the data from the text file so that they are already there and ready to go. Changes at this point can be made if needed, or with a couple of check boxes and a next button the program can be on it's way. Here's a sample (edited of course as to not cause problems with my company):

dialogbox 0 8 10 300 100 2 "Make selections then hit next"
radiogroup 1 Choice ; Define single/multi group.
radiobutton 2 5 5 65 12 "&Single"
radiobutton 3 5 15 65 12 "&Multiple"
endgroup
pushbutton 4 220 5 50 15 "&Next"
radiogroup 5 TypeBF
radiobutton 6 100 5 65 12 "&cap1"
radiobutton 7 100 15 65 12 "&cap2"
radiobutton 8 100 25 65 12 "&cap3"
endgroup
checkbox 18 5 40 70 10 "option 1" opt1
checkbox 19 5 50 65 10 "option 2" opt2
checkbox 9 80 40 65 10 "option 3" opt3
checkbox 10 80 50 70 10 "option 4" opt4
checkbox 11 155 40 40 10 "option 5" opt5
checkbox 13 155 50 50 10 "option 6" opt6
checkbox 14 205 40 65 10 "option 7" opt7
checkbox 12 205 50 65 10 "option 8" opt8
checkbox 20 205 59 69 11 "option 9" opt9
editbox 21 5 60 13 10 s0 2
TEXT 22 20 60 180 10 "<-----Enter # (Leave blank if single)" Left
editbox 23 5 70 30 10 s1 10
TEXT 24 40 70 180 10 "<-----Enter Code" Left
editbox 25 5 80 80 10 s1 80
TEXT 26 88 80 180 10 "<-----Directory Path" Left

enddialog


So there's my dialogue box. Any help would be greatly appreciated. Thanks,

Solinus
 
Also, if anyone knows how in the world I can use dynamic directories to write the file that would be ideal. Example:

My script path is setup to: C:\data\scripts

When the config file is written, I want the default directory to be whatever path is set in the script path setting. In windows I know you can do things like %SYSTEM%\path1\path2 but is it possible to do this with Aspect?

Thanks again!
 
Never mind on the last post. I used $ASPECTPATH and that works like I want it to. :)
 
This is what I do, store the variables in a file.

At the end of the script, when the user hits "save" or "go" in the dialog box, I have this code

proc Save_Data
;process to save dialog box data to file

fopen 0 "repeat.txt" create text ;open file

fputs 0 string1 ;write strings
fputs 0 string2
fputs 0 string3
fclose 0

endproc


Then when I start the script, I have this code


fopen 0 "repeat.txt" read text ;open the repeat file
fgets 0 string1
fgets 0 string2
fgets 0 string3
fclose 0

The strings(1-3) are the variables in the dialog box. For the integers in your dialog box, you will need to convert to strings to store in a file
 
Solinus, are you good to go? I didn't realize when I read your last followup that you might have only addressed the followon problem and not the original one as well.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top