Jump to content

BitAND


Recommended Posts

$t = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Icon","0")
$r = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Notify","0")
$s = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Record","0")
;=================
If BitAND($t,$r,$s) = 1 Then MsgBox(0,"","test")

is this outputing wat i think its supposed to be outputing?

does that mean they all equal 1 or would i change the = 1 to = 3? to show that they all equal 1 ......in other words is bitAND the sum ?

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Link to comment
Share on other sites

I couldn't explain but.. this is the example

Example

$x = BitAND(13, 7) ;x == 5 because 1101 AND 0111 = 0101

$x = BitAND(2, 3, 6) ;x == 2 because 0010 AND 0011 AND 0110 = 0010

this is use of hex ( i think )

8)

<{POST_SNAPBACK}>

no your just giving me a headache from the confusion i cant understand that for sh*t

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Link to comment
Share on other sites

$a = 1
$b = 2
$c = 4
$d = 8
$answer = $c + $b

If BitAND($answer,$b) Then MsgBox(0,"test","Bit Found")
If Not BitAND($answer,$a) Then MsgBox(0,"test","Bit Not Found")
If BitAND($answer,$c) Then MsgBox(0,"test","Bit Found")

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Uh, why not just test it yourself?

msgbox(0,0,BitAnd(1, 1, 1)); = 1
msgbox(0,0,BitAnd(1, 0, 1)); = 0
msgbox(0,0,BitAnd(1, 0, 0)); = 0

Anyway, if you want the sum:

If ($t + $r + $s) = 3 Then MsgBox(0,"","test")

As for explaining the functions, I'll do my best.

The way the functions work, in my understanding, is it evaluates whatever number you give it in binary. (ie: 13 = 1101, 7 = 0101).

BitAND then compares which bits (the 1's or 0's) are set in each number you give it.

BitAND(13, 7)

Number A: 13 = 1101

Number B: 7 = 0101

"The first bit of A is 1. The first bit of B is 0. These do not match. Return 0.

The second bit of A is 1. The second bit of B is 1. Both values are 1. Return 1.

The third bit of A is 0. The third bit of B is 0. Both values are 0. Return 0.

The fourth bit of A is 1. The fourth bit of B is 1. Both values are 1. Return 1."

Return 0

Return 1

Return 0

Return 1

Full Return = 0101

0101 in decimal = 5

Function return: 5

So BitAnd(13, 7) = 5
Link to comment
Share on other sites

i really want to grasp this thing cuz its a nesecity in the script im making

Opt("WinTitleMatchMode", 1)
;=======
$t = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Icon","0")
$r = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Notify","0")
$s = IniRead("C:\Program Files\Pop-Up Blocker\System.ini","Settings","Record","0")
;============
If $t = 1 Then Opt("TrayIconHide",1)
;=============
;=================
If BitAND($t,$r,$s) = 1 Then MsgBox(0,"","test")
While 1
    If WinExists("http://") Then    
       WinClose("http://")
    EndIf
WEnd

ok now i need to put certain things in betweeen While 1 and WEnd like "Filewrite line","Tray Tip" but if the keys in the ini are 0 i dont want the file and tray things .....

do u understand wat im saying and bitAND i was using that so like if ($t + $r +$s) = 3 do everything and if = 2 only do this and stuff

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Link to comment
Share on other sites

i really want to grasp this thing cuz its a nesecity in the script im making

If you want to understand it, stop making idiotic posts like the two below (Yes, I'm aware this is chronologically out of sequence).

no your just giving me a headache from the confusion i cant understand that for sh*t

OMG MIGRANE!!!!!!!

Really dude, you're getting very annoying very fast. If you want to learn AutoIt, act like you have some semblance of sense about you, if not, leave the forum and don't pester us with your childish antics. We've all seen your posts up until now and I think all of us are in agreement that you've acted quite immature in virtually all of them.
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...