fluflu Posted April 17, 2020 Share Posted April 17, 2020 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 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 Hi @fluflu and welcome to the AutoIt forums Which is the title of thr website you get? Could you please post the code you used? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 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. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 @fluflu Check the value of $BOOLtrouve before compairing it, so, adding a MsgBox() or a ConsoleWrite() will help you a bit Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 the value is 0 Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 @fluflu Can't you access this Portal with Internet Explorer? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 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. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 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: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2020 Share Posted April 17, 2020 Do a Sleep (5000) after refresh : Send("{F5}"). 5000 may be too much, so test with different values... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 @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? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 1 minute ago, fluflu said: So to use the _IE fuctions I have to use internet explorer, right? Yes You have to be more precise about what you want to get from your script. Is this text contained somewhere? Button? Div? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 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 Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2020 Share Posted April 17, 2020 Show the DOM where the word you are looking for appears “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 @NineWhat's the "DOM"? I've tried using IE but the portal doesn't allow acces on Internet Explorer Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2020 Share Posted April 17, 2020 You right click on the word you are looking for, on the pop up menu, click Inspect. That is the DOM, copy it and paste it here. If you cannot use IE, you will have to use WebDriver “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 <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 Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2020 Share Posted April 17, 2020 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. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
fluflu Posted April 17, 2020 Author Share Posted April 17, 2020 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 Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2020 Share Posted April 17, 2020 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. fluflu 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 17, 2020 Share Posted April 17, 2020 @fluflu Glad I could help, and have a good day you too fluflu 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now