Jump to content

Trouble with WinClose


 Share

Recommended Posts

Thats really weird. I can confirm your problem. It seems to me like a bug. Maybe you should submit a bug on the issue tracker.

Edited by P5ych0Gigabyte
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

For some reason I can't get the following line of code to work. I'm using v3.3.1.2 (beta).

WinClose("AutoIt")

That command seems to work with any other window title name besides AutoIt. Why?

Please show the code just before that line - hopefully, it is not something like this:
MsgBox(0, 'AutoIt', '')
WinClose("AutoIt")

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

It's definitely a bug. Whats even more odd is that it seems to crash the script. If I run the following script the msgbox is never shown. However if the first line is commented out it runs fine. :)

WinClose("AutoIt")
MsgBox(0,"hello","testing")
WinClose("test")

I am really curious to see what could of caused such wackiness.

Edited by P5ych0Gigabyte
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Please show the code just before that line - hopefully, it is not something like this:

MsgBox(0, 'AutoIt', '')
WinClose("AutoIt")

I have a folder named "AutoIt" on the desktop. I open the folder so it's visible. I run the script with the line above and it executes without closing the window or throwing any warnings/errors.
Link to comment
Share on other sites

OK i figured out what is going on. AutoIt has a hidden window that it creates when it is running. The title is "AutoIt V3". Running WinClose("AutoIt") teminates the window which kills the script. But changing the title of the autoit window first allows it to work.

AutoItWinSetTitle("")
WinClose("AutoIt")
MsgBox(0,"hello","testing")
WinClose("test")

So its not really a bug.

Edited by P5ych0Gigabyte
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

... AutoIt has a hidden window that it creates when it is running. The title is "AutoIt V3". ...

Yep - I was going to lead the OP to that possibility.

I use the code that used to be the answer to this FAQ

http://www.autoitscript.com/autoit3/docs/faq.htm#14

It renames that hidden window - so I'm used to thinking about that hidden window.

@OP,

Get the handle of the window after you open it and use that to close the window of interest.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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...