I use this:
To show window and this:
To hide window, but how can I find out if it's being hidden/showed?
if(winget(usr, "craftingwindow", "is-visible") == "true")) //window is visible to them
else //window is not visible to them

Note: Do not use usr in procs if you are doing this.

-- Data
In response to Android Data
Nah... I'm not using usr in proc, I found out like month ago why you say not to use usr in proc, that happened when I started coding again...