A quick update to this thread.
I realised that with a really easy mod, Naphier's solution works for all versions of Windows.
The end of every AppGameKit folder ends with:
"/AGK/APPNAME/"
So you can simply remove 2 of the string tokens and you get the My Documents folder. Here's my routine for returning the My Documents path, not optimised yet. location$ is the folder you want to use or create within My Docs.
Function getWriteLocation(location$)
path$ = GetWritePath()
`*** Documents path = path - 2 "/"
count = countStringTokens(path$, "/")
if count > 2 then count = count - 2
dim strings[count] as string
for n = 1 to count
strings[n] = GetStringToken(path$ , "/" , n)
next n
for n = 1 to count
MyDoc$ = MyDoc$ + strings[n] + "/"
next n
SetRawWritePath(MyDoc$)
` If folder doesn't exist, create it
found = 0
folder$ = GetFirstFolder()
while folder$ <> "" and found = 0
if folder$ = location$
found = 1
else
folder$ = GetNextFolder()
endif
endwhile
SetFolder("") //so it isn't "media"
if found = 0
MakeFolder(location$)
endif
setRawWritePath(path$)
undim strings[]
endfunction MyDoc$