|
|
LinkBack | Thread Tools | Display Modes |
#1
|
||||
|
||||
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. |
#2
|
||||
|
||||
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 |
Tags |
binary, converting, nerds, string, unite |
|
|
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 |