Sign in to follow this  
Followers 0
rudi

Howto use: WinWaitClose($handle)

12 posts in this topic

#1 ·  Posted (edited)

Hello,

doesn't WinWaitClose() accept a windows handle set through $handle = WinGetHandle("Title","Text") ?

When working with "title","text" this script works fine:

While 1
    While ProcessExists("newsreader3.exe")
        If WinActive("Post Message") Then ; es wird neu gepostet
            $Forum = ControlGetText("Post Message", "", "Edit2")
            If StringInStr($Forum, "novell.support.netware") Then ; Das ist ein Netware Forum
                $handle = WinGetHandle("PostMessage")
                ControlFocus($handle, "", "TExRichEdit1")
                Send("^a")
                Send("{del}")
                FillClip()
                Send("^v")
                ControlFocus($handle, "", "TExRichEdit2") ; set focus to 'subject'
            EndIf
            ConsoleWrite("Warte auf Fenster wech..." & @LF)
            WinWaitClose($handle, "")
            ConsoleWrite("Fenster wieder weg" & @LF)
        EndIf
    WEnd
    Sleep(10000) ;XN nicht gestartet, länger loopen...
WEnd

This way ($handle in stead of "title","text") the script doesn't recognize when the window is gone :)

I want this script to fill in a calculated signature using XanaNews.

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites



I would wager a guess that since this line:

$handle = WinGetHandle("PostMessage")

Is in your If...Then...EndIf condition, the condition is not being met. You can test the by trying to display the handle:

MsgBox(0,"",$handle)

WinWaitClose($handle, "")

You should just put WinGetHandle() before the If...Then...EndIf

Share this post


Link to post
Share on other sites

In addition to what Weapon_X posted:

Make sure that Opt("WinTitleMatchMode") is properly set.

Titles are case sensitive

See the help file for Window Titles and Text (Advanced) under Using AutoIt.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I would wager a guess that since this line:

$handle = WinGetHandle("PostMessage")

Is in your If...Then...EndIf condition, the condition is not being met. You can test the by trying to display the handle:

MsgBox(0,"",$handle)

WinWaitClose($handle, "")

You should just put WinGetHandle() before the If...Then...EndIf

<Doh!> You are so right!!

Anyways, I tried to change it the way you mentioned and this like, still doesn't work:

While 1
    While ProcessExists("newsreader3.exe")
        If WinActive("Post Message") Then ; es wird gepostet
            $Forum = ControlGetText("Post Message", "", "Edit2")
            If StringInStr($Forum, "novell.support.netware") Then ; Das ist ein Netware Forum
                $handle = WinGetHandle("PostMessage")
                ControlFocus($handle, "", "TExRichEdit1")
                Send("^a")
                Send("{del}")
                NW65EOL()
                Send("^v")
                Send("{home}")
                Send("{down 2}")
                ControlFocus($handle, "", "TExRichEdit2")
                ConsoleWrite("Warte auf Fenster wech..." & @LF)
                WinWaitClose($handle)
                ConsoleWrite("Fenster wieder weg" & @LF)
            EndIf
        EndIf
    WEnd
WEnd

:) What do I mess up this time? :)

Thanks, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

<Doh!> You are so right!!

Anyways, I tried to change it the way you mentioned and this like, still doesn't work:

While 1
    While ProcessExists("newsreader3.exe")
        If WinActive("Post Message") Then ; es wird gepostet
            $Forum = ControlGetText("Post Message", "", "Edit2")
            If StringInStr($Forum, "novell.support.netware") Then ; Das ist ein Netware Forum
                $handle = WinGetHandle("PostMessage")
                ControlFocus($handle, "", "TExRichEdit1")
                Send("^a")
                Send("{del}")
                NW65EOL()
                Send("^v")
                Send("{home}")
                Send("{down 2}")
                ControlFocus($handle, "", "TExRichEdit2")
                ConsoleWrite("Warte auf Fenster wech..." & @LF)
                WinWaitClose($handle)
                ConsoleWrite("Fenster wieder weg" & @LF)
            EndIf
        EndIf
    WEnd
WEnd

:) What do I mess up this time? :)

Thanks, Rudi.

$handle = WinGetHandle("PostMessage")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Hi.

$handle = WinGetHandle("PostMessage")
What's wrong with that line? $handle is working fine for all other lines I use it?

:) Confused, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hi.

What's wrong with that line? $handle is working fine for all other lines I use it?

:) Confused, Rudi.

You have "PostMessage" as one word Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You have "PostMessage" as one word

I need a new smiley to use here, pls: Hit my head against a wall.... :)

Remains the question, why all the other uses of $handle DO work even with my typo?

If these would have failed as well, I would have recognized my typo...

Now it's working as expected:

While 1
    While ProcessExists("newsreader3.exe")
        If WinActive("Post Message") Then ; es wird gepostet
            $Forum = ControlGetText("Post Message", "", "Edit2")
            If StringInStr($Forum, "novell.support.netware") Then ; Das ist ein Netware Forum
                $handle = WinGetHandle("Post Message")
                ControlFocus($handle, "", "TExRichEdit1")
                Send("^a")
                Send("{del}")
                FillClip()
                Send("^v")
                Send("{home}")
                Send("{down 2}")
                ControlFocus($handle, "", "TExRichEdit2")
                ConsoleWrite("Warte auf Fenster wech..." & @LF)
                WinWaitClose($handle)
                ConsoleWrite("Fenster wieder weg" & @LF)
            EndIf
        EndIf
    WEnd
WEnd

Thanks, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

I need a new smiley to use here, pls: Hit my head against a wall.... :)

Remains the question, why all the other uses of $handle DO work even with my typo?

If these would have failed as well, I would have recognized my typo...

Now it's working as expected:

While 1
    While ProcessExists("newsreader3.exe")
        If WinActive("Post Message") Then ; es wird gepostet
            $Forum = ControlGetText("Post Message", "", "Edit2")
            If StringInStr($Forum, "novell.support.netware") Then ; Das ist ein Netware Forum
                $handle = WinGetHandle("Post Message")
                ControlFocus($handle, "", "TExRichEdit1")
                Send("^a")
                Send("{del}")
                FillClip()
                Send("^v")
                Send("{home}")
                Send("{down 2}")
                ControlFocus($handle, "", "TExRichEdit2")
                ConsoleWrite("Warte auf Fenster wech..." & @LF)
                WinWaitClose($handle)
                ConsoleWrite("Fenster wieder weg" & @LF)
            EndIf
        EndIf
    WEnd
WEnd

Thanks, Rudi.

Because as far as I could see you only made the mistake in one place and you did that when you made your last change.

BTW Do you mean like this :)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

BTW Do you mean like this :)

Oh, yes, mad2 is exactly what I was looking for

:lol::):lol::):lol::D:D :D :D;):D:lmao::D:lmao::D:lmao::D

Is there a complete list of all smileys not available in the smiley dropdown selection list?

Thanks, regards, Rudi.

--

:lol: :mad1: :lmao: :mad3:

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Oh, yes, mad2 is exactly what I was looking for

:lol::):lol::):lol::):lol::D:D :D :D;):D:lmao::D:lmao::D

Is there a complete list of all smileys not available in the smiley dropdown selection list?

Thanks, regards, Rudi.

--

:lmao: :mad1: :lmao: :mad3:

Smiley Dropdown. Top item (Show All)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

:)

Smiley Dropdown. Top item (Show All)

Great collection! Thanks, Rudi. :)

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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