Jump to content

Difference between = and ==


Recommended Posts

i whud just for fun change

MsgBox(1, "", "")

to

MsgBox(1, "", '"'&_IEPropertyGet($oQuery, "outertext")&'"')

to see if result is identical on = and ==

Nice one, the output is 0 on "=" and the string when using "==" ... but then why does it "enter" the ifstatement if it is 0 and not "Controle & Oplevering".

Link to comment
Share on other sites

So i know you found a way to hack-around the code to make it work... which is always bad unless you're a manager on commission...

however when you tested this, did you perform a multi-run test on both instances (20+ tests) to ensure that what you are saying is 100% accurate? It 100% of the time only works when used with "==" and 100% of the time fails when used with "=" ?

The issue here doesn't make sense that it would have to do with "==" and "=" because you're saying your msgbox() pops up every time. The issue has to lie with $oQuery.click. Since it is a method, it's supposed to be called as $oQuery.click() as Trancexx has explained, which you stated that in your entire code, you've neglected to use the braces. Although you say it does work, it's not the way it's meant to be written and should be changed throughout to avoid any future errors in both logic and implementation.

And I apologize if I missed it, but you didn't state whether or not you had appended the braces to the method to see if it creates the same issue.

Hi, thanks for the reply. If i insert $oQuery.click() it gives the same outcome..

And yes, it is 100% accurate.. i tested this over 100 times.

Link to comment
Share on other sites

@notsure its not a nice one, if something doesnt work you need to ckeck for errors, i dont know the tupe of error that is happening but im shure that water-s code whud reproduce something similar but i hardly think someone tested this suggestion, note that in time of error in most functions they do return 0.

so im just gona repeat the trancexx words.

That's very likely just bad coding.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

@notsure its not a nice one, if something doesnt work you need to ckeck for errors, i dont know the tupe of error that is happening but im shure that water-s code whud reproduce something similar but i hardly think someone tested this suggestion, note that in time of error in most functions they do return 0.

so im just gona repeat the trancexx words.

That's very likely just bad coding.

So, it is good coding if something works with "==" and if I delete 1 "=" its named bad coding? Please explain whats bad about the code? This is the only code i have, so you (or trancexx) should be able to point out what's bad about this code?

Anyway, i tested Water's method, but @error also gives 0 and most of the times that means > 0 ($_IEStatus_Success) = No Error

I dont know where i can check the error-code for a ***.click method?

Link to comment
Share on other sites

Bad coding is:

  • Not to check if the function you called is successful
Will extend the list after I checked your code ...

Give this a try and post the results:

$oTagCollection = _IETagNameGetCollection($oIE, "TD")
ConsoleWrite("GetCollection: " & @error & "-" & (IsObj($oTagCollection)) & @CRLF)
For $oTag In $oTagCollection
    $sProperty = _IEPropertyGet($oTag, "outertext")
    ConsoleWrite("Property: " & ">" & $sProperty & "<" & @CRLF)
    If $sProperty = "Controle & Oplevering" Then
        MsgBox(1, "", "")
        $oTag.click()
        ConsoleWrite("Click: " & @error & @CRLF)
        ExitLoop
    EndIf
Next
_IELoadWait($oIE)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Bad coding is:

  • Not to check if the function you called is successful
Will extend the list after I checked your code ...

Ok thanks, I understand.

This works tho;

If string(_IEPropertyGet($oQuery, "outertext")) = string("Controle & Oplevering") Then

So its comparing a string to an integer and thinks its equal.... interesting.

Link to comment
Share on other sites

AutoIt doesn't "think" - it has strict "rules" how to process your script. One of this "rules" is how to handle strings. Check this.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

AutoIt doesn't "think" - it has strict "rules" how to process your script. One of this "rules" is how to handle strings. Check this.

I know, its logic, but i'm trying to figure out the logic.

I think i get it;

It compares integer vs string.

The outcome of number("Controle & Oplevering") will be 0

So the IFstatement matches.

Then it will try to $oQuery.click a control which does not exist on the webpage.

Right?

Link to comment
Share on other sites

Right.

Did you run my extended version of the script I posted above?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

This still does not answer the main question, but ok :)

Did you read my post (#38) or look at the example code?

The "=" operator treats "" and 0 and Chr(0) and False as all the same.

The "==" operator discriminates between them. I've found it very useful to tell the difference between a 0 and an empty/null string ("").

Link to comment
Share on other sites

$oQuery isn't defined.

Sorry. Replace "$oQuery.click()" with "$oTag.click()"

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Sorry. Replace "$oQuery.click()" with "$oTag.click()"

Ye i did, and it gives a totally different outcome... the "==" reads another table than "=" in the HTML doc.

As said, i cannot post the total-outcome because of companyinfo.

Link to comment
Share on other sites

Small example;

-------CUT ALOT OF DATA--------------

Property: >0<
Property: >COMPANY INFO
Property: >31/01/07 08:33<
Property: >14/02/07 01:15 <
Property: >0<
Property: >0<
Property: >IP Services Basis<
Property: >31/01/07 08:33<
Property: >05/02/07 08:39 <
Property: >0<
Property: >0<
Property: >COMPANY INFO
Property: >31/01/07 08:33<
Property: >05/02/07 08:39 <
Property: >0<
Property: >0<
Property: >COMPANY INFO
Property: >31/01/07 08:33<
Property: >05/02/07 08:39 <
Property: >0<
Property: >0<
Property: >COMPANY INFO
Property: >31/01/07 08:33<
Property: >05/02/07 09:08 <
Property: >0<
Property: >0<
Property: >COMPANY INFO
Property: >31/01/07 08:33<
Property: >04/03/09 08:37 <
Property: >0<
Property: >0<
Property: >Controle & Oplevering<
Click: 0

This goes for the "=="

GetCollection: 0-1
Property: > <
Property: >  <
Property: >COMPANY INFO
 <
Property: > <
Property: >   
Order Manager
Order Overzicht
Wachtende orders
Foutieve orders
Opgeleverde orders

Service Manager
Order Overzicht

This goes for the "="

Edited by notsure
Link to comment
Share on other sites

So, it is good coding if something works with "==" and if I delete 1 "=" its named bad coding? Please explain whats bad about the code?

Bad coding is everything you do witout checking

so

if Not @error And $returndata Then

so check return data and check if something is inside

== is correct way to compare 2 strings and shud not be called workaround in this case.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Can you explain why you have

_IELoadWait($oIE)
at the end of your script?

Shouldn't it be at the top so the script waits until the page is completely loaded?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can you explain why you have

_IELoadWait($oIE)
at the end of your script?

Shouldn't it be at the top so the script waits until the page is completely loaded?

The only 2 lines above this part of code are the IE include and _IEATTACH.

In case of the "oquery.click" it clicks a javalink inside a webpage, so its gonna load.

The website is build with links like this;

<tr class="uneven_link" onclick="location.href='?page=bla bla bla'">

So there is no other way to "click" the link IMO. Also _IEnavigate is more complex as i need to trim the variables from the URL given in location.href... there are alot of numbers i need inside the link to perform _IEnavigate properly. Thats why I like this way more.

Edit; did you see the outcome of the properties... (from your code)? Kinda strange if you ask me.

Edited by notsure
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...