Sign in to follow this  
Followers 0
mabriseb

Disable GUI when a file exist

5 posts in this topic

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

Share this post


Link to post
Share on other sites



While FileExists(@ScriptDir & "\List\1.txt")
   GUISetState (@SW_DISABLE)
Wend

GUISetState (@SW_ENABLE)


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Thanks!!! It's working without put the sleep command but maybe I will use it on my old computer where this script will be use


MatMontreal, Canada

Share this post


Link to post
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
Sign in to follow this  
Followers 0