Sign in to follow this  
Followers 0
mikezwet2

If message then

11 posts in this topic

#1 ·  Posted (edited)

Hello,

Sometimes a message is posible when there is no search result in IE. My script have te click this message away and do something else.

Problem is i dont know how to put this message in a if formule.

If MsgBox ( 0, "Microsoft Internet Explorer", "") = 0 Then         ;this line <<<<
      Send("{ENTER}") 
      Send("{TAB 5}")  
      Send("{ENTER}")

      AutoItSetOption ("WinTitleMatchMode", 2)
      WinClose("Microsoft Internet Explorer", "")


Else


      Send("{TAB}") 
      Send("{ENTER}")
      Sleep ( 250 )
      Send("{TAB}") 
      Sleep ( 250 )
      Send("{ENTER}") 
      Sleep ( 250 )
      Send ("^a")
      Sleep ( 250 )
      Send ("^c")
      
      AutoItSetOption ("WinTitleMatchMode", 1)
      WinClose("Nieuw bericht", "") 
      
      AutoItSetOption ("WinTitleMatchMode", 2)
      WinClose("Microsoft Internet Explorer", "") 

EndIf

Hope you experts can help me.

btw i found out its hard for a rookie to learn the code and combinations of it

Edited by mikezwet2

Share this post


Link to post
Share on other sites



btw i found out its hard for a rookie to learn the code and combinations of it

:whistle: Kozijnen is gemakkelijker ?

Anyway, maybe you need to explain a bit more about what you exactly want to do.

I see in your code that YOU display a MsgBox() But you test for 0 which should never be retuned.

WinWait() waits for a particular window title/text combo

WinExists(0 check if a window exists with the Title/text combo

Is that what you are looking for ?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

:whistle: Kozijnen is gemakkelijker ?

Anyway, maybe you need to explain a bit more about what you exactly want to do.

I see in your code that YOU display a MsgBox() But you test for 0 which should never be retuned.

WinWait() waits for a particular window title/text combo

WinExists(0 check if a window exists with the Title/text combo

Is that what you are looking for ?

Winwait and WinExits could be ok but the script not only has to wait and click the message, it also have to do something when its not appear and something if it appear.

Oke step by step.

Search in IE

Type search string

Press search button

If message "Nothing found" appears

click OK

Click cancel search

Close IE window

Else

Go on with te script....

Hope its clear what is have to do with te message that could be appear sometimes.

Edited by mikezwet2

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Winwait and WinExits could be ok but the script not only has to wait and click the message, it also have to do something when its not appear and something if it appear.

Oke step by step.

Search in IE

Type search string

Press search button

If message "Nothing found" appears

click OK

Click cancel search

Close IE window

Else

Go on with te script....

Hope its clear what is have to do with te message that could be appear sometimes.

With "Search in IE" you mean : Activate IE window and type Ctrl+F, type the search argument in the Find Window and click "Find Next". Then wait for the Not Found window else move on ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

With "Search in IE" you mean : Activate IE window and type Ctrl+F, type the search argument in the Find Window and click "Find Next". Then wait for the Not Found window else move on ?

Yeah Thats right!

Share this post


Link to post
Share on other sites

Maybe something like this to get you started:

; Start Search
$SearchText = "Kozijn"
AutoItSetOption ("WinTitleMatchMode", 2)
; Close find window whe exists
If WinExists("Find","") Then
    WinActivate("Find","")
    Send("{Esc}")
EndIf
WinActivate("Microsoft Internet Explorer","")
WinWaitActive("Microsoft Internet Explorer","")
Sleep(1000)
;Send("^F")
Send("!EF")
WinWait("Find","")
; Specify Search text and enter
Send($SearchText & "{Enter}")
; Loop till not found

While 1
    ; Give time to find it
    Sleep(500)
    If WinExists("Microsoft Internet Explorer","Finished searching the document.") Then
        MsgBox(0,"Not Found","Not Found")
        ExitLoop
    EndIf
    MsgBox(0,"Found","Found")
    ;Do what needs to be done when found
    ;
    ;
    ;
    ; Activate Find window
    WinActivate("Find","")
    ; Find Next
    Send("{Enter}")
WEnd
; Close find window 
If WinExists("Microsoft Internet Explorer","Finished searching the document.") Then
    WinActivate("Microsoft Internet Explorer","Finished searching the document.")
    Sleep(200)
    Send("{Enter}")
EndIf

If WinExists("Find","") Then
    WinActivate("Find","")
    Sleep(200)
    Send("{Esc}")
EndIf

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Maybe something like this to get you started:

Thanks JdeB.

I still figure it out. Whole script works only the part down here is not working. The not found message is not clicked away :whistle: Because of that, the script dont choose the right desision...

Opt("TrayIconDebug", 1); Curser on systray icon will give current script line.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("31", $dll) Then

Sleep ( 250 )


While 1
If WinExits("Microsoft Internet Explorer","Het doorzoeken van het document is voltooit")  Then
    Sleep ( 250 )
    Send("{ENTER}") 
    WinClose("Microsoft Internet Explorer","Het doorzoeken van het document is voltooit") 
    
else


WinActivate("FileMaker Developer", "")
WinWaitActive("FileMaker Developer")

EndIf
WEnd

    EndIf
WEnd
DllClose($dll)

Not found message:

Posted Image

Not found message AutoIt info:

Posted Image

Edited by mikezwet2

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Mike, misschien is voltooid verkeerd gespeld in je Win???? Functies ? :whistle:

De Window Title/Text moet exact zijn!

In mijn voorbeeld doe ik een Enter omdat het niet een standaard Window is met standaard Controls.

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Mike, misschien is voltooid verkeerd gespeld in je Win???? Functies ? ;)

De Window Title/Text moet exact zijn!

In mijn voorbeeld doe ik een Enter omdat het niet een standaard Window is met standaard Controls.

Damn, dump blond mike :whistle:

Script works great now :P Thanks for help!!

Is is possible to run a script in the background, witout you see the steps ?

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