The OpenToWrite command works in the sand box area by default.
On Windows only, in theory anyway, you can use the SetRawWritePath to change that. But the app needs the proper permissions, as Paul says.
OpenToRead always checks in the sand box area first and then the local media area (the media directory for Tier 1 or the executable directory for Tier 2).
If you create a file with OpenToWrite that has the same name as one in the local media directory, that is the one used for the next OpenToRead for that file name. Unless you delete it, then the OpenToRead will go after the one in the local media directory again.
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master