Jump to content

Recommended Posts

Posted

Hello,

I'm trying to use WinExists on a web page but it doesn't work. I don't think the code is wrong because it works with other pages.

Is it possible that the web sites in blocking WinExists?

If yes do you have any idea to know if a world is present on the web page?

Have a nice confinement ^^

Fluflu

Posted

Hi @FrancescoDiMuro, thanks for replying me!

it's a private portal.

Here is my code but again it works on other sites. The global aim of the code is to get notified when a word of the page is removed. I can't use any function that require the URL because i have to connect to the portal.

Spoiler

HotKeySet("!{x}", "_Exit")                       
Opt("WinTitleMatchMode", 3)                     ; This is to tell the script to only refresh the EXACT window, incase there are similar windows.
While 1 ;
Sleep(2000)                                   
  $title = WinGetTitle("Chrome", "")           
If WinExists($title) Then
  WinActivate($title)                          
  WinWaitActive($title)                       
  Send("{F5}")
  $BOOLtrouve = WinExists($title,"Présence")
  If ($BOOLtrouve="0") Then
      MsgBox(0,"","The word has desapeared!")
  EndIf

Else                                             ; This is an else statement to tell the script to do a different operation if the window is not running.
  Sleep(10)                                     ; Just a filler item to wait until the desired window is running.
EndIf                                             ; End the If statement to continue the script.
WEnd                                             ; Close the While LOOP
Func _Exit()                                     ; This is the function that is linked to the kill switch, ALT+X. It tells the script to perform the following actions.
Exit                                             ; In this case it is to close the entire program.
EndFunc                                         ; Close the function up.

 

 

Posted

Yes i can but it's gone be the same,isn't it?

I've tried the search part of my code without the refresh part and it works!

Spoiler

#include <StringConstants.au3>
#include <MsgBoxConstants.au3>


$title = WinGetTitle("Firefox", "")

If WinExists($title) Then
  WinActivate($title)                          
  WinWaitActive($title)                       
  $texte = WinGetText($title)
  MsgBox(0,"",$texte)
  $BOOLtrouve = WinExists($title,"Vous")
  If ($BOOLtrouve="1") Then
      MsgBox(0,"","Appel!")
  Else
      MsgBox(0,"","pas troivé")
  EndIf
EndIf

This is pretty weird.

 

Posted
1 minute ago, fluflu said:

Yes i can but it's gone be the same,isn't it?

Not really.
With IE UDF you could do something like this:

#include <IE.au3>

Global $objIE

$objIE = _IECreate("https://www.autoitscript.com/autoit3/docs/libfunctions/_IEPropertyGet.htm", 0, 1)

ConsoleWrite("Title of the tab: " & _IEPropertyGet($objIE, "title") & @CRLF)
ConsoleWrite("Title of the Window: " & WinGetTitle(_IEPropertyGet($objIE, "hwnd")) & @CRLF)

_IEQuit($objIE)

:)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted

@Nine

I've tried that and it doesn't change anything

@FrancescoDiMuro

i don't understand your code, it just get the property of the titles... But I will try using _IEBodyReadText and then search my ord in the variable.

So to use the _IE fuctions I have to use internet explorer, right?

Posted

I want it to check if a particular word have disapeared or not. So its a loop where

1) i refresh the page

2)i check if the particular word is present on the page

Posted
Posted

<div class="alert alert-success">
                                Vous avez été noté présent le 17/04/2020 à 14h48                            </div>

 

@Nine Is it that?

Ok i will try with webdriver

Posted

Exactement fluflu.  You can read all tags with div and search for innertext that contains the word "Présent".  There is a learning curve to get accustomed to the UDF, but it is worth the effort, as you will have much more control over your browser.  Bonne chance.

Posted

ok guys @Nine @FrancescoDiMuro I finally suceed it!!

All my problems only came from one line : Opt("WinTitleMatchMode", 3)

I read that it is to tell the script to only refresh the EXACT window, incase there are similar windows so this is why i have put it in my script.

Is it really for that? And if yes do u know what happened?

 

Thanks a lot for taking the time to help me!

have a great day guys

Posted

Opt("WinTitleMatchMode", 3) means that the title of the windows must be exactly the same as what you have provided in the function.  It is also case-sensitive.  So either there were additional characters in the window title or it was not spelled correctly (case wise).  In other words, there was a mismatch between the string and the real window title.  

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