On 2/28/07, Curtis Ford <[EMAIL PROTECTED]> wrote:
My project needs to allow the user to enter data which is then saved to
an external text file. It has worked fine on OS X in the IDE and
standalone. When I tried from a Windows standalone, the external file is
written but is empty (0 kb). Here's the code:

on saveNewFile
  global gMyFileName,gEntireList,gMyLoop,gCurrentSet
  ask file "Save list as" with "MyList.txt"
  put it into gMyFileName
  --separate handler saves current set of data to gCurrentSet
  saveCurrentSet
--is the current set already in gEntireList?
  put lineOffset("<itemIDnum=" & gMyLoop, gEntireList) into tSetStart
  if tSetStart = 0 then
    --it wasn't there, so append the set just entered to the end of
gEntireList
    put gCurrentSet after gEntireList
  end if
  open file gMyFileName for update
  answer "now doing saveNewFile: gEntireList is" && gEntireList
  put gEntireList into URL ("file:" & gMyFileName)
end saveNewFile

I put the 'answer' command right before the final 'put gEntireList..'
command to make sure the variable had the expected contents, and it did;
but the resulting text file is always empty on XP.

I'm developing on OS X 10.4.8, testing on Windows XP; using Rev 2.8, but
I checked earlier versions of the project and the problem is there in
2.6 as well.

I don't know a lot about Windows or where to go on with troubleshooting.
Help! Thanks in advance!



Put a line after the "put into URL" line saying:
if the result is empty then answer the result

This is at least tell you if there is an error while saving. My guess
would be that you are running into a permissions problem - you are
coming to a sad realization :-). If you are trying to save to the
Program Files folder (or a sub-folder in it), then unless you have
admin privileges, this will fail I think. Like you I am not a Windows
expert, but I think that is correct. Try saving the file in other
locations and seeing if that works. Ken Ray's site lists the codes
needed to get specialFolderPath to give you the path to various
Windows folders.

HTH,
Sarah
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to