LuigiBem Posted February 13, 2015 Share Posted February 13, 2015 This is not a game. This guy also wanted to know but I don't see the answer: '?do=embed' frameborder='0' data-embedContent>> ;This works If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt = "Nope" ;Why doesn't this If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt = "Nope" It's another one of those things not in Help. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 13, 2015 Developers Share Posted February 13, 2015 (edited) This is not a game. This guy also wanted to know but I don't see the answer: '?do=embed' frameborder='0' data-embedContent>> ;This works If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt = "Nope" ;Why doesn't this If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt = "Nope" It's another one of those things not in Help. So what is your problem as they are 2 different tests? What are you expecting? Post something that really shows your issue instead of a few lines that don't have any meaning. Jos Edited February 13, 2015 by Jos 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 More sharing options...
water Posted February 13, 2015 Share Posted February 13, 2015 First example needs only one of the camparisons to be true. For the second example both need to be true. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2015 Moderators Share Posted February 13, 2015 LuigiBern,It works for for me: expandcollapse popup; Both match $fPath = "..\Quest" Global $wrt[2] = [0, 0] $TurnIt_1 = "Yep!" $TurnIt_2 = "Yep!" If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt_1 = "Nope" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt_2 = "Nope" ConsoleWrite("Both match: " & $TurnIt_1 & " - " & $TurnIt_2 & @CRLF) ; Path matches $fPath = "..\Quest" Global $wrt[2] = [0, 1] $TurnIt_1 = "Yep!" $TurnIt_2 = "Yep!" If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt_1 = "Nope" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt_2 = "Nope" ConsoleWrite("Path matches: " & $TurnIt_1 & " - " & $TurnIt_2 & @CRLF) ; wrt matches $fPath = "..\Quest0" Global $wrt[2] = [0, 0] $TurnIt_1 = "Yep!" $TurnIt_2 = "Yep!" If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt_1 = "Nope" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt_2 = "Nope" ConsoleWrite("wrt matches: " & $TurnIt_1 & " - " & $TurnIt_2 & @CRLF) ; Neither match $fPath = "..\Quest0" Global $wrt[2] = [0, 1] $TurnIt_1 = "Yep!" $TurnIt_2 = "Yep!" If $fpath = "..\Quest" Or $wrt[1] = 0 Then $TurnIt_1 = "Nope" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt_2 = "Nope" ConsoleWrite("Neither match: " & $TurnIt_1 & " - " & $TurnIt_2 & @CRLF)Why do you think it does not? M23 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...
LuigiBem Posted February 13, 2015 Author Share Posted February 13, 2015 I will not refute my ingnorance here. I have no idea how this works. I expected the "And" to work the same as the "Or". I was hoping I could use the "Nope" as a variable later, but the script terminates. The conditions match but the MsgBox comes back empty. MsgBox(0, "$fpath", $fpath) ;This tests "..\Quest" MsgBox(0, $wrt[1], $wrt[1]) ;This "0" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt = "Nope" MsgBox(0, $TurnIt, $TurnIt) I've tried all combinations of quotes: ($fpath = "..Quest") And ( the like... Link to comment Share on other sites More sharing options...
water Posted February 13, 2015 Share Posted February 13, 2015 (edited) I expected the "And" to work the same as the "Or". Why should it work the same way? If you have a glass of beer AND a cup of coffe you have two beverages. If you have a glass of beer OR a cup of coffe you have at least one beverage. So And <> OR. Edited February 14, 2015 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2015 Moderators Share Posted February 13, 2015 LuigiBem.Once again it works fine for me: $fPath = "..\Quest" Global $wrt[2] = [0, 0] $TurnIt = "Yep!" MsgBox(0, "$fpath", $fpath) ;This tests "..\Quest" MsgBox(0, $wrt[1], $wrt[1]) ;This "0" If $fpath = "..\Quest" And $wrt[1] = 0 Then $TurnIt = "Nope" MsgBox(0, $TurnIt, $TurnIt)I would recommend declaring $TurnIt before trying to access it as I have done above. M23 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...
LuigiBem Posted February 13, 2015 Author Share Posted February 13, 2015 My mistake. I expected it to work similar. The "Or" continues on. The "And" Terminates the Script. The conditions seem to be met for both, as far as I can tell, yet they are not working similarly as I see it. I don't understand why $TurnIt does not fill the MsgBox with "Nope". Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2015 Moderators Share Posted February 13, 2015 LuigiBem, I don't understand why $TurnIt does not fill the MsgBox with "Nope".Do you not see "Nope" when you run the script I posted immediately above? The "Or" continues on. The "And" Terminates the ScriptNot exactly. What happens is this:; Here is the line with And If condition_1 And condition_2 Then ; And needs both conditions to be true or it fails If True And True Then ; Both true and it works If False And True Then ; One false and it does not work - in fact AutoIt never even looks at the second condition If True And False Then ; One false and it does not work If False And False Then ; Both false and it does not work - again AutoIt never even looks at the second condition ; Here is the line with Or If condition_1 Or condition_2 Then ; Or needs only one of the two conditions to be true If True And True Then ; Both true and it works - AutoIt does not even look at the second condition If False And True Then ; One true and it works If True And False Then ; One true and it works - again AutoIt does not even look at the second condition If False And False Then ; Both false and it does not workI hope that makes it clearer. M23 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...
Solution LuigiBem Posted February 13, 2015 Author Solution Share Posted February 13, 2015 $fPath = "..\Quest" It turned out $fpath had a bug upstream which had caused me to question the difference between "And" & "Or". You have made it very clear that I needed to look elsewhere for the bug. Thank you very much for the explanation And Or understanding to resolve this issue. Link to comment Share on other sites More sharing options...
SadBunny Posted February 14, 2015 Share Posted February 14, 2015 Why should it work the same way? If you have a glass of beer AND a cup of coffe you have two beverages. If you have a glass of beer OR a cup of coffe you only have one beverage. So And <> OR. Not exactly true... If you have a glass of beer OR a cup of coffee, all you know is that you didn't have no beverage. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
water Posted February 14, 2015 Share Posted February 14, 2015 Ops, you are correct. Should be "at least one beverage" Somehow I had "Exclusive Or" in mind. Fixed. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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