Jump to content

If message then


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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 ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

: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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 ?

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