Skrip Posted December 2, 2005 Posted December 2, 2005 could a partial window name work, in any way? $win_name = "PARTIAL NAME" While 1 sleep(100) if WinExists($win_name) Then MsgBox(64,"Alert", "IF <NAME> EXISTS MESSAGE HERE") EndIf WEnd could something like that work? [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
Valuater Posted December 2, 2005 Posted December 2, 2005 Maybe this $win_name = "PARTIAL NAME" While 1 sleep(100) if WinExists($win_name) Then MsgBox(64,"Alert", "IF " & $win_name" & " EXISTS MESSAGE HERE") EndIf WEnd 8)
Skrip Posted December 2, 2005 Author Posted December 2, 2005 (edited) Thanks alot!(by the way you missed a ")$win_name = "PARTIAL NAME"While 1 sleep(100)if WinExists($win_name) Then MsgBox(64,"Alert", "IF " & "$win_name" & " EXISTS MESSAGE HERE")EndIfWEndbut thanks for help Edited December 2, 2005 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
Shinies Posted December 2, 2005 Posted December 2, 2005 Would the uhmmm, whats it called.... o ya Opt("WinSetTitleMatch", 1) or something like that, i forget wat its called.
Skrip Posted December 2, 2005 Author Posted December 2, 2005 oh sorry, I didn't see that code in the documentation [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
herewasplato Posted December 3, 2005 Posted December 3, 2005 Actually, there was one extra quote in Valuater's very fast reply.MsgBox(64,"Alert", "IF " & $win_name" & " EXISTS MESSAGE HERE")You did thank him - but you seem to have "corrected his code" by adding another extra quote:(by the way you missed a ")...MsgBox(64,"Alert", "IF " & "$win_name" & " EXISTS MESSAGE HERE")I think that is should be like this:MsgBox(64,"Alert", "IF " & $win_name & " EXISTS MESSAGE HERE")There should not be quotes around the variable during concatenation......unless you were going for msg text like this for some reason:IF $win_name EXISTS MESSAGE HEREthen you can stick with:MsgBox(64,"Alert", "IF " & "$win_name" & " EXISTS MESSAGE HERE") ....or justMsgBox(64,"Alert", "IF $win_name EXISTS MESSAGE HERE")Both of those will not display the value of the variable....but the OPT setting is all you needed. [size="1"][font="Arial"].[u].[/u][/font][/size]
Skrip Posted December 3, 2005 Author Posted December 3, 2005 (edited) Yes but I added some more to it but its giving me an error (ya i did try it like this MsgBox(64,"Alert", "IF " & $win_name" & " EXISTS MESSAGE HERE") and this MsgBox(64,"Alert", "IF " & $win_name & " EXISTS MESSAGE HERE") and so far i've got this $win_name = "MSN" While 1 sleep(100) if WinExists($win_name) Then MsgBox(64,"Alert", "Alert") if WinExists($win_name) Then WinClose("$win_name", "") EndIf WEndIm using MSN as a test page (msn.com)I want the script to give the alert then close the "$win_name" or the page its alerting fromwhen i open it, it says WEnd is not a command, and when i remove it, it says EndIf is not finished without WEndplease helpheres the errorLine 14 (File "C:\Autoit3\testwin.au3"): WEnd Error: "Wend" statement with no matching "While" statement. Edited December 3, 2005 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
herewasplato Posted December 3, 2005 Posted December 3, 2005 try:AutoItSetOption("WinTitleMatchMode", 2) $win_name = "MSN" While 1 Sleep(100) If WinExists($win_name) Then MsgBox(64, "Alert", "Alert") WinClose("$win_name", "") EndIf WEnd [size="1"][font="Arial"].[u].[/u][/font][/size]
Skrip Posted December 3, 2005 Author Posted December 3, 2005 (edited) Thanks that worked but is there a way to make the window close when the alert thing pops up? EDIT: I just found the WinClose thing but its not working... please fix Edited December 3, 2005 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
MSLx Fanboy Posted December 3, 2005 Posted December 3, 2005 MsgBox pauses script execution. That means that the windows won't close until a message box button is clicked. Try putting WinClose before the MsgBox Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
Skrip Posted December 3, 2005 Author Posted December 3, 2005 didn't work AutoItSetOption("WinTitleMatchMode", 2) $win_name = "MSN" While 1 Sleep(100) If WinExists($win_name) Then WinClose("$win_name", "") MsgBox(64, "Alert", "Alert") EndIf WEnd [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
MSLx Fanboy Posted December 3, 2005 Posted December 3, 2005 It should be: WinClose($win_name) What you have right now, it's looking for a window title that is really "$win_name" (not "MSN") Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate())
Skrip Posted December 3, 2005 Author Posted December 3, 2005 ya, thanks that worked [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
herewasplato Posted December 3, 2005 Posted December 3, 2005 It should be:WinClose($win_name)What you have right now, it's looking for a window title that is really "$win_name" (not "MSN")Thanks for correcting that - I had to leave for a while right after I posted that quick copy/paste/sloppy edit/error! [size="1"][font="Arial"].[u].[/u][/font][/size]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now