TheDcoder

Boolens: Does not work as expected in case of strings

5 posts in this topic

Hello, I am in a little confusion with Boolens :unsure:, Here is my code:

ConsoleWrite(("Something" = "Samething") & @CRLF) ; False
ConsoleWrite((Not "Something" = "Samething") & @CRLF) ; True
ConsoleWrite((Not False) & @CRLF) ; True

I have commented the results which I expected, but the expression in the 2nd line is not working as expected :unsure:, Can anyone explain to me?

SciTE Output:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\TheDcoder\Desktop\AIO AutoIt Test Script.au3" /UserParams    
+>20:26:24 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00004009  OS:WIN_81/  CPU:X64 OS:X64    Environment(Language:0809)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\TheDcoder\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\TheDcoder\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.1)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\TheDcoder\Desktop\AIO AutoIt Test Script.au3
+>20:26:24 AU3Check ended.rc:0
>Running:(3.3.14.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\TheDcoder\Desktop\AIO AutoIt Test Script.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
False
False
True
+>20:26:24 AutoIt3.exe ended.rc:0
+>20:26:24 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.8031

Thanks in Advance, TD :)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites



use parenthesis like this:

ConsoleWrite(("Something" = "Samething") & @CRLF) ; False
ConsoleWrite(Not("Something" = "Samething") & @CRLF) ; True <--- use parenthesis
ConsoleWrite((Not False) & @CRLF) ; True

 

1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

@Chimp Thanks! :D


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Operators precedence forces the evaluation of Not 'Something' and that then forces conversion of the string to a number 'Something' evaluates to zero then Not 0 evaluates to anything distinct from zero, say 1, but then 1 = 'Samething' is False (since that string also evaluates to 0).


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

@jchd Exactly! :D


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
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

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning
      I was trying to replace 2 identical characters from a string, but I didn't manage to with StringReplace()...
      Does anyone know how to replace two ( i.e. : """" with ";" ) ? 
      Thanks  
    • Paranthaman
      By Paranthaman
      Hi,
      I want to click a link by the element ID through IEGetObjById.
      <!DOCTYPE html> <html> <body> <button type="button" id="Random-1-ID" onclick="alert('Hello world!')"></button> </body> </html> I intend to click the button with ID"Random-1-ID". But on every refresh the ID changes to next number like "Random-2-ID" "Random-3-ID"
       
      The code i which i wrote for this function is
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("I:\Documents\1. Work\Automation\My codes\Collections\11. Clicking button by Value and ID\button.html") Local $oDiv = _IEGetObjById($oIE, "Random-1-ID") _IEAction($oDiv, "click") _IELoadWait($oIE) So can anyone help me to alter this code like it clicks for every ID in format "Random-%-ID"
    • Surf243
      By Surf243
      I'm having a weird issue with an invisible character (specifically: '?' mark) appearing in my CSV when my script reads it. I've isolated it down to a simple script so I can share it easily.
      Has anyone experienced this issue?
      How would I be able to detect/remove invisible characters?
      For this specific case FileExist would fail. I could do StringReplace or StringRegExp, but what if it's not a '?' mark or a unc path?
      Note: I can see the question mark if I open the CSV in notepad, but not in Excel.
       
      Code:
      $sPath1 = "\\Server\Share\Folder1‎" ; Copied from Excel 2013 $sPath2 = "\\Server\Share\Folder1" ; Typed out in SciTE ConsoleWrite(@CRLF) ConsoleWrite($sPath1 & @TAB & StringLen($sPath1)) ConsoleWrite(@CRLF) ConsoleWrite($sPath2 & @TAB & StringLen($sPath2)) ConsoleWrite(@CRLF & @CRLF) Screenshot:

      Script:
      Path_Test.au3
       
      Any assistance is appreciated, Thanks!
    • ur
      By ur
      I am assigning the current time stamp to a variable $strtTime and holding the execution for 5 seconds with Sleep and calculating the current time stamp.
      Ideally, the _DateDiff should give 5 seconds as output as i gave the parameter as s.But it is giving zero 0.
      Any suggestions....!
      Global $startTime = _Date_Time_GetLocalTime() $startTime = _Date_Time_SystemTimeToDateTimeStr($startTime) Sleep(5000)     $tCur = _Date_Time_GetLocalTime()     $tCur = _Date_Time_SystemTimeToDateTimeStr($tCur) $iDateCalc = _DateDiff('s', $startTime, $tCur)     MsgBox(0,"$iDateCalc",$iDateCalc)     FileWrite ($QTPfile,CHr(34) & $tCur & CHr(34) & Chr(44) & """" & $iDateCalc & """,")  
    • ioripalm
      By ioripalm
      How a lot of string formatted output to a printer?
      E.g:
      1) The first line of Arial font and size 20 and Bold
      2) The second line to the fourth line of  Tahoma font and size 14
      3) Insert two blank lines every 5 row
      4) Every 64 rows to add a page break (chr(12) ) and add headers and footers
      5) Finally, the formatted string output to a printer(Dot matrix printer)
      How to do that?The printer supports ESC / P,  ESC / P2,  ESC / PK, ESC / PK2,  Epson Standard Code for Printer.
      Thank you very much!!!