Jump to content

winclose - downst work all the time


Recommended Posts

Hi coders,

 

ive got a lil problem with closing a window.

The windowtitel got a countdown inside so that i cant set the window tittel

someone got an idea how to make it?

eg its like au3.info: titel: 59m:50s - text

the timer goes down to 0

 

 

Link to comment
Share on other sites

What have you tried?  None of the advanced title matching techniques have worked?

https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm

 

Edited by TheXman
Link to comment
Share on other sites

Thanks for you replay TheXman

no those ways dont work for me

But i found an post that helped me out

"" There is a option named "WinTitleMatchMode", if you change this to 2 then it will match any substring in the title (Help file).

Here's how:

 

Opt("WinTitleMatchMode",2)
WinActivate("Test Application")

""

so now i got 3 windows opened

im looking for close the browser with the name "Test Application"

 

The way to close the browsers with the name i did it is not lets say clean but it works XD


 

ShellExecute("C:\3.lnk")
Sleep(3000)
ShellExecute("C:\4.lnk")
Sleep(3000)
ShellExecute("C:\5.lnk")

Opt("WinTitleMatchMode",2)
WinWait("Test App")
WinClose("Test App")
Opt("WinTitleMatchMode",2)
WinWait("Test App")
WinClose("Test App")
Opt("WinTitleMatchMode",2)
WinWait("Test App")
WinClose("Test App")
WinWaitClose("[CLASS:Chrome_WidgetWin_1]")

MsgBox(1,"","",0)

maybe you got a cleaner way to close the windows ?

 

 

Link to comment
Share on other sites

It talks about WinTitleMatchMode on the page that I referenced in my original post.  As a matter of fact, it's on the first line of the page and the part right below that shows the different modes.  Obviously you didn't read it.  I not wasting anymore of my time.

Link to comment
Share on other sites

Hi coders here i am again : )

ive created this code.

i run 6 windows at same time, when the browsertitel shows "free" the window where its shown sould close.

most of the times it also works.

but lets say about 1/4 of the time the window doesnt close.

can you pelase have a look where the error is inside?

 

#RequireAdmin

ShellExecute("C:\1.lnk")
Sleep(3000)
ShellExecute("C:\2.lnk")
Sleep(3000)
ShellExecute("C:\3.lnk")
Sleep(3000)
ShellExecute("C:\4.lnk")
Sleep(3000)
ShellExecute("C:\5.lnk")
Sleep(3000)
ShellExecute("C:\6.lnk")



Sleep(30000*5)
Opt("WinTitleMatchMode",2)
;~ WinWait(" free")
WinClose(" free")
Sleep(5000)
Opt("WinTitleMatchMode",2)
;~ WinWait(" free")
WinClose(" free")
Sleep(5000)
Opt("WinTitleMatchMode",2)
;~ WinWait(" free")
WinClose(" free")
Sleep(5000)
Opt("WinTitleMatchMode",2)
;~ WinWait(" free")
WinClose(" free")
Sleep(5000)
Opt("WinTitleMatchMode",2)
WinWait(" free")
WinClose(" free")
Sleep(5000)
Opt("WinTitleMatchMode",2)
WinWait(" free")
WinClose(" free")
WinWaitClose("[CLASS:Chrome_WidgetWin_1]")
Sleep(5000)
ShellExecute(@ScriptDir & "\2.exe")

 

Link to comment
Share on other sites

Like Danp2 said, check WinClose's return

It looks like you have a space before free, check that.

Also, Opt is usually used once at the top of your script. It sets that option until it is changed by another Opt line, or the script ends.

And this is nitpicking, but "My brain hurts!": Why are you using 30,000 * 5? I'm sure you know what that is multiplied out, and if you're going to use multiplication in your script like that, at least have it make sense... like displaying it in minutes: 2.5 * (60 * 1000)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

6 hours ago, seadoggie01 said:

Like Danp2 said, check WinClose's return 

It looks like you have a space before free, check that.

Also, Opt is usually used once at the top of your script. It sets that option until it is changed by another Opt line, or the script ends.

And this is nitpicking, but "My brain hurts!": Why are you using 30,000 * 5? I'm sure you know what that is multiplied out, and if you're going to use multiplication in your script like that, at least have it make sense... like displaying it in minutes: 2.5 * (60 * 1000)

Like Danp2 said, check WinClose's return 

how to check the return ?

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