Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Binary parsing of a variable?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,28650
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Binary parsing of a variable?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Binary parsing of a variable? - 12/5/2005 5:29:40 AM   
  stickyc

 

Posts: 1
Score: 0
Joined: 12/5/2005
Status: offline
I'd like to be able to use a serial number to drive the available set of Features in a Wise installer. The thinking is that I'd use one byte of the serial number as a bit-mask, each bit would set a Property indicating if the user has access to a certain Feature or not.

I'm new to VBscript, are there any tricks to go about doing this? Off the top of my head, I figured I would get the mid$ of the variable to isolate the one byte I was using as the key, then do a series of OR statements with each possibility (looping is out, since each Property being set needs to be a descriptive name).

Is there a better way?
 
 
Post #: 1
 
 RE: Binary parsing of a variable? - 12/6/2005 5:39:23 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
stickyc    

Maybe you can use the AND operator.

result = expression1 And expression2

The And operator also performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result.


Good luck !

_____________________________

Regular Expression ? I (L+o{1,}v{1,3}e\s)+[iI]t!$

(in reply to stickyc)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Binary parsing of a variable? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts