Okay I went back and checked the permissions thing. I have read and write to it and I copied the file to my desktop to make sure. Permissions are not the issue. But I am getting empty when I read from the file now, whereas before "it" never changed when I read from a file. BTW I AM running code in a button that is part of a group that is a background. Possible issue?? Here is the updated code:

ON mouseUp
    answer file "Select the program file to import:" of type "F+PR"
    put it into mfilename
    IF mfilename is empty THEN exit mouseup

    put slyfilefrompath(mfilename) into mshortfile
    IF char -4 of mshortfile is "." THEN
        put char 1 to -5 of mshortfile into mmodule
    END IF

    IF there is a card (mmodule) THEN
        go card (mmodule)
    ELSE
        new card
        set the name of this card to tolower(mmodule)
    END IF

    -- Read from file method
    open file mfile
    put the result into mres
    -- mres is empty here indicating a successful open
    read from file mfile at 1 until eof
    -- it is empty here!!!!! AAAAAGGGGKKKKKKKK!
    put it into field code
    close file mfile

    -- URL method
    -- put "file:" & mfilename into mfile
    -- put url mfile into field code

set the text of field "lblcode" to "Code: " & tolower (slyfilefrompath(mfilename))
END mouseUp


Ya know I opened the file in a text editor without a problem, but did not try to write to it, thinking that since I only tried to read from it in Revolution I should be able to do so. I should get the result when I open a file anyways but thsi was a quick and dirty utility. I will give that a try. I suspect you may have nailed it.

Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

Bob,

I've seen this exact behavior when trying to read a file for which I do not have write permission. (If memory serves, checking the result right after the open file or read from file with give you an error message.) Try using

open file myfile for read

before you do read from file. Either that or change the permissions on the files you're reading.

Devin

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

Reply via email to