Perth-WRX.com  

Go Back   Perth-WRX.com > Off Topic Discussions > Gaming and Multiplayer
Register Diddy Kart ArticlesAll AlbumsBlogs FAQ Community Calendar Today's Posts Search


Welcome to Perth-WRX, click here to register!

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 23-02-2010, 04:47 PM
DAN682's Avatar
Sign me up!
Nazi Sled Driver
 
Join Date: Jul 2005
Location: Mandurah
Posts: 2,364
Thanks: 25
Thanked 13 Times in 9 Posts
DAN682 at standard level
Send a message via ICQ to DAN682 Send a message via MSN to DAN682 Send a message via Yahoo to DAN682
Default Nerds Unite! Need help converting a string to Binary

We have just put a new Document management system in and to automate the registering process, I have to push a change out to all users machines so that their Active Directory Display Name is pumped into Office (2003) (Tools --> Options --> User Information Tab under the Name: Field

Anyway, Off to google for help. ner nerrrr

Off to Experts-exchange for help, new question...

Got a reply, run this code:

Dim Path , o, ws
Dim objADsUser, objADSystemInfo, objDisplayName
err.Number = 0
Set objADSystemInfo = CreateObject("ADSystemInfo")
Set objADsUser = GetObject("LDAP://" & objADSystemInfo.UserName)
objDisplayName = objADsUser.DisplayName
Path = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\ Common\UserInfo\"
set ws = WScript.CreateObject("WScript.Shell")
o = ws.RegWrite(Path & "UserName", objDisplayName, "REG_SZ")
Set WSHShell = nothing

Easy! However, it pumps the username in as a string (REG_SZ), I need it to convert he display name from ASCII to Binary.

Any nerd know how to do this?

I know, this is not www.perth-nerds.com but there was a problem loading page

So here is worth a try instead!

Last edited by DAN682; 23-02-2010 at 04:49 PM.
Reply With Quote
  #2  
Old 23-02-2010, 05:25 PM
gmastah's Avatar
Potty Training Scoobie Noobie
Member
 
Join Date: May 2008
Location: Perth
Posts: 31
Thanks: 2
Thanked 0 Times in 0 Posts
gmastah at standard level
Default

Hey Dan,

I hope this helps:

Public Class CalculateFunctions

Public Function Cal_CharToBinary(ByVal CharStr As String) As String

Dim LastValue As Integer

Dim BinaryArr() As String

Dim BinaryStr As String

Dim i As Integer

LastValue = Asc(CharStr)

i = 0

ReDim BinaryArr(i)

While LastValue <> 0

ReDim Preserve BinaryArr(i)

BinaryArr(i) = LastValue Mod 2

LastValue = LastValue \ 2

i = i + 1

End While

If UBound(BinaryArr) >= 0 Then

For i = 0 To UBound(BinaryArr)

BinaryStr = BinaryArr(i) & BinaryStr

Next

BinaryStr = String.Format("0", 8 - Len(BinaryStr)) & BinaryStr

End If

Cal_CharToBinary = BinaryStr

End Function

If you work it out let me know... I'm sure it's somewhere along those lines...

Anyways, back to real work! ahahahah :P
Reply With Quote
Reply

Tags
binary, converting, nerds, string, unite


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prank Callers Unite! berrjona Non-WRX Discussion 18 20-01-2010 09:56 AM
Converting mp3 to mmf Golding Non-WRX Discussion 1 11-06-2008 10:29 PM
converting RX or whatever Phoeni_x General Subaru Discussion 25 12-11-2007 11:09 AM
fs: 5 string bass guitar hoppus For Sale 1 17-10-2007 10:09 AM
Converting HP To KW???? IMPRESHER Mechanicals 14 03-08-2006 11:01 AM



Welcome to Perth-WRX, click here to register!

All times are GMT +8. The time now is 02:55 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO