monty12345 Posted January 14, 2021 Share Posted January 14, 2021 hello! ive have been trying to use IF statement in order to automate a web page. Apparent all the logic that goes through IF is considered TRUE by the compiler! _IELoadWait($browser) Local $oButtons = _IETagNameGetCollection($browser, "b") ;gets all the Element with <b> tag For $oButton In $oButtons ; loops through the element with <b> tags If $oButton.outertext == "Next Chapter:" Or "Next Chapter: " Then ;only click the elements with outertext "Next Chapter" _IEAction($oButton, 'click') ; it clicks all the elements with <b> tags EndIf Next Link to comment Share on other sites More sharing options...
argumentum Posted January 14, 2021 Share Posted January 14, 2021 if $var = "string" then ok if $var = "string" or "string" then wrong if $var = "string" or $var = "string" then ok monty12345 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted January 14, 2021 Share Posted January 14, 2021 It is because your if statement is badly written. You should consider reading help file to understand the very basic of the language. If $oButton.outertext = "Next Chapter:" Or $oButton.outertext = "Next Chapter: " Then == is case sensitive, and applies only to strings while = is not. monty12345 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...
monty12345 Posted January 14, 2021 Author Share Posted January 14, 2021 lol i am such a nub Link to comment Share on other sites More sharing options...
monty12345 Posted January 14, 2021 Author Share Posted January 14, 2021 @Nine i am soo sorry for clearing my basics first! i really appreciate it! Link to comment Share on other sites More sharing options...
Nine Posted January 14, 2021 Share Posted January 14, 2021 (edited) No problem. Enjoy your reading. BTW be careful with the ending space when comparing string that can be tricky... Use instead : If StringStripWS($oButton.outertext, 3) = "Next Chapter:" Then Edited January 14, 2021 by Nine “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...
Moderators Melba23 Posted January 14, 2021 Moderators Share Posted January 14, 2021 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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