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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem saving an external file. Please help! 1

Status
Not open for further replies.

PaulShotgun

Technical User
Mar 7, 2002
10
GB
I want to put a button in my Authorware piece that saves a users test report to a text file. How do I do this?

This test report is plain text (with some variable-pointers) that will not appear on the screen. The user does a test, and then to see how when they have done in the test, they should have to look at the text file authorware creates after they click the button 'Save test report
to disk'.

I have considered the WriteExtFile function for this, but the two main problems with this way of doing it are:

- I cannot use proper formatting in the report. It seems to be just ascii without wrapping. (unless I am mistaken?)

- I need a "browse" button to force the user to point to the folder they want to save the file.

I am using Authorware5 and the package will be delivered on CD (not on the web at all).

Any ideas? The simpler and easier the better please!!

Thanks in advance,

Paul
 
It is AASCI, you'll need to use ^Return etc to format it in a crude way, or else use one of the clumsy report writers for authorware 5. Look in the Knowledge Objects 'interface' group for a KO to save files.

RonM
 
For the "browse" button, you can use the KO like Ron said--it's called "Browse Folder Dialog Knowledge Object" in Authorware 5. There are other UCD's & such that you could use as well, but the KO is probably the simplest and easiest.

The option Ron gave might be the easiest but I have a few suggestions that are pretty simple and a little more flexible as well--not to mention free...they still use the WriteExtFile() function.

If you know HTML, you can write the file out as a HTML rather than plain text. Just create a variable (say HTMLFile) where you plug the variable and static information along with html tags to format it to make it look pretty. They you just use WriteExtFile to write out the variable to a file, making sure to name it with a .html or .htm extension.

Another simple option is to create the page you want to print in wordpad (make sure to use wordpad and not MS word). Where you want to put in variable information, put the variable name in between characters--for example where you want the score to appear, put <SCORE> in the wordpad file. Save it as an rtf. Then in your Authorware program, you read in the file, replace the <SCORE> with the variable name, and write it back out. Sample code would look something like this:

PrintFile:=ReadExtFile(FileLocation ^ &quot;RTF_file.rtf&quot;
PrintFile:=Replace(&quot;<SCORE>&quot;, Score, PrintFile)
WriteExtFile(FileLocation ^ &quot;certificate.rtf&quot;)

you could add a JumpOutReturn() or JumpPrintReturn() to open or print the file once it's created.

HTH
steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top