Jump to content

Disable GUI when a file exist


Recommended Posts

I would like to freeze my GUI for the time that a file exist and when the file has been deleted the GUI is enable again. I tried the script below but it's not working

$sortie = 0

GUISetState (@SW_DISABLE)

Do

$test = FileExists(@ScriptDir & "\List\1.txt")

If $Test = 1 Then

Else

$Sortie = 1

EndIf

until $Sortie = 0

GUISetState (@SW_ENABLE)

MatMontreal, Canada

Link to comment
Share on other sites

If you find that the above code makes your CPU crazy (I haven't tried it but it looks like it may) then you may prefer this code:

guiSetState(@SW_DISABLE)

while (fileExists(@scriptDir & "\list\1.txt"))
    sleep(250)
wEnd

guiSetState(@SW_ENABLE)
Link to comment
Share on other sites

Yeah I was thinking that LxP :), I was going to consider changing it to what you have above or something like below, but your's seems to be less complicated.

$Temp = 0

While FileExists(@ScriptDir & "\List\1.txt")
   If $Temp = 0 Then GUISetState (@SW_DISABLE)
   $Temp = 1
Wend

GUISetState (@SW_ENABLE)
Edited by Burrup

qq

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...