I am a real shell script novice, but I find that:
set writable to do shell script "test -w " & myPosix & "; echo $?"
returns the opposite of what I would expect.
“0” – if file IS writeable
"1" – if file is NOT writeable.
This seems opposite of this reference:
The following operators returns true if file exists:
FILE exists and write permission is granted
So, I changed your script to be logical (for me):
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set myFile to choose file
set myPosix to quoted form of POSIX path of myFile
--- Returns bool true IF file is writable ---
set writable to (do shell script "test -w " & myPosix & "; echo $?") = "0"
This works in my testing, but then I’m probably missing something.