Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


ascii to text (outlook pst files)

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> ascii to text (outlook pst files)
  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 >>
 ascii to text (outlook pst files) - 5/2/2007 12:06:45 AM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline
yo

trying to convert some lovely ascii into hex too add to the registry!
after seeing robszars find PST http://www.visualbasicscript.com/m_44947/mpage_1/key_/tm.htm#46533 very similar idea. 

keep getting a Type Missmatch error on line 23, 4
 

      


 




< Message edited by chong -- 5/2/2007 12:12:56 AM >
 
 
Post #: 1
 
 RE: ascii to text (outlook pst files) - 5/2/2007 12:47:14 AM   
  dm_4ever


Posts: 2585
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
It looks like the formating is a bit off there...which line is line 23?

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to chong)
 
 
Post #: 2
 
 RE: ascii to text (outlook pst files) - 5/2/2007 1:01:33 AM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline
f***** visual studio >8(

line 23:

objShell.RegWrite strRegpath & regKey, 1,
"REG_BINARY"
 
i call asciitoHex(pst) on line 22. but when i try either writing to a txtfile or wscript.echo i get the type mismatch
 

Dim
objNetwork, FSO, pstFolder
Dim strPSTpath, file, pstFiles
Set objNetwork = CreateObject("Wscript.Network")
strUser = objNetwork.UserName
strPSTPath = "\\ex\dfs\lo_userprof\"&strUser&"\mailsettings\"
wscript.echo strPSTPath
'get PST filenames.
Set FSO = CreateObject("Scripting.FileSystemObject")
Set pstFolder = FSO.GetFolder(strPSTPath)
Set pstFiles = pstFolder.Files
Set objShell = CreateObject("wscript.shell")
strRegpath = "HKCU\SOFTWARE\Microsoft\Windows NT\currentVersion\Windows Messaging Subsystem\Profiles\MailProfile\"

For Each pst in pstFiles
     regKey = AsciiToHex(pst)
     objShell.RegWrite strRegpath & regKey, 1, "REG_BINARY"
Next

 Function AsciiToHex(sData)
     Dim i, aTmp()
     ReDim aTmp(Len(sData) - 1)
     For i = 1 To Len(sData)

         aTmp(i - 1) = Hex(Asc(Mid(sData, i)))
          if len(aTmp(i - 1))=1 then aTmp(i - 1)="0"+ aTmp(i - 1)
     Next
     ASCIItoHex = aTmp

End
Function



< Message edited by chong -- 5/2/2007 1:03:29 AM >

(in reply to dm_4ever)
 
 
Post #: 3
 
 RE: ascii to text (outlook pst files) - 5/2/2007 5:43:26 AM   
  dm_4ever


Posts: 2585
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I've never tried writing binary values with WScript.Shell...I prefer using WMI and StdRegProv for all my registry changes.

If you try to echo or write to your text file you will get an error because you need to loop through you array to see its values or maybe use the Join function.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to chong)
 
 
Post #: 4
 
 RE: ascii to text (outlook pst files) - 5/2/2007 7:56:45 PM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline
nice idea. thanx dm, will let u kno how i get on.

(in reply to dm_4ever)
 
 
Post #: 5
 
 RE: ascii to text (outlook pst files) - 5/2/2007 7:59:18 PM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline
that actually makes legible sense, seeing as

hex(asc(mid("my string here"))) will only return the first ASCII character as HEX.

I.E
out of "my string here" only "m" is returned as a hexadecimal value.

(in reply to chong)
 
 
Post #: 6
 
 RE: ascii to text (outlook pst files) - 5/2/2007 9:21:11 PM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline
Just having a problem with objShell.regwrite

Need to set the name of key + value + type


      

(in reply to chong)
 
 
Post #: 7
 
 RE: ascii to text (outlook pst files) - 5/2/2007 10:15:16 PM   
  chong

 

Posts: 74
Score: 0
Joined: 12/20/2006
Status: offline

type mismatch on second to last line in example below. I'd say because strRegVal = "43 3A 5C 70 73 74 5C 6D 79 74 65 73 74 70 73 74 2E 70 73 74" and when you use REG_BINARY it should be integer. but that, to me, doesnt make any sense because HEX is not just integers...arrgh!!

For
Each pst in pstFiles
myArray = AsciiToHex(pst)
For each character in myArray
strregVal = strregVal + character &
" "

Next
wscript.echo strRegPath
wscript.echo strregVal
intKey = intKey + 1
objShell.regwrite strRegpath & KeyName, strregVal,
"REG_BINARY"

Next

(in reply to chong)
 
 
Post #: 8
 
 RE: ascii to text (outlook pst files) - 5/3/2007 12:51:17 AM   
  dm_4ever


Posts: 2585
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
You may just change your function to build a string and never bother converting to hex. 

If you decide to go with WMI, look at the SetBinaryValue method that takes an array as the input for the values: http://msdn2.microsoft.com/en-us/library/aa393286.aspx

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to chong)
 
 
Post #: 9
 
 
 
  

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 >> ascii to text (outlook pst files) 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