Jump to content

Recommended Posts

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]

Link to post
Share on other sites

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")

EndIf

WEnd

but thanks for help

Edited 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]

Link to post
Share on other sites

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 HERE

then you can stick with:

MsgBox(64,"Alert", "IF " & "$win_name" & " EXISTS MESSAGE HERE") ....or just

MsgBox(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]

Link to post
Share on other sites

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


WEnd

Im 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 from

when i open it, it says WEnd is not a command, and when i remove it, it says EndIf is not finished without WEnd

please help

heres the error

Line 14 (File "C:\Autoit3\testwin.au3"):

WEnd

Error: "Wend" statement with no matching "While" statement.
Edited 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]

Link to post
Share on other sites

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

Link to post
Share on other sites

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]

Link to post
Share on other sites

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]

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...