tjacob Posted June 5, 2008 Share Posted June 5, 2008 Hi. Anyone able to provide any input would be greatly appreciated. I'm stuck. Below is a snippet of the code from for the function. I did try searching for some previous examples but did not turn anything up. This script gathers what Outlook PST's are assigned to a user's profile using MAPI. I have a functional version in VB but for other reasons would desire taking this to AutoIt to compile into a executable. I have included the working VB and the portion of AutoIt that will not work. It seems to break at the StringInstr($strPath,":\")-1). ---VB Snippet Function GetPSTPath(input) For i = 1 To Len(input) Step 2 strSubString = Mid(input,i,2) If Not strSubString = "00" Then strPath = strPath & ChrW("&H" & strSubString) End If Next Select Case True Case InStr(strPath,":\") > 0 GetPSTPath = Mid(strPath,InStr(strPath,":\")-1) Case InStr(strPath,"\\") > 0 GetPSTPath = Mid(strPath,InStr(strPath,"\\")) End Select End Function ---Code snippet for AutoIt Func GetPSTPath($input) For $i = 1 To StringLen($input) Step 2 $strSubString = StringMid($input,$i,2) If Not $strSubString = "00" Then $strPath = $strPath & $ChrW("&H" & $strSubString) EndIf Next Select Case 1=StringInstr($strPath,":\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,":\")-1) Case 1=StringInstr($strPath,"\\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,"\\")) EndSelect EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2008 Developers Share Posted June 5, 2008 (edited) Without reading through the whole snippet i see a fundemental issue. This: If Not $strSubString = "00" Then Should be If Not ($strSubString = "00") Then or If $strSubString <> "00" Then and this Case 1=StringInstr($strPath,":\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,":\")-1) Case 1=StringInstr($strPath,"\\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,"\\")) Should be Case StringInstr($strPath,":\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,":\")-1) Case StringInstr($strPath,"\\") > 0 $GetPSTPath = StringMid($strPath,StringInstr($strPath,"\\")) Jos Edited June 5, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
tjacob Posted June 6, 2008 Author Share Posted June 6, 2008 Thanks for the reply Jos. This has helped some but I think where I am having issues now is with the Unicode to Ascii conversion of the string. Below is the full code of the script. Any input? I'm actively looking but just thought I would pose the question unless anyone has any ideas. Thanks Tom --- #include <string.au3> #include <outlook.au3> Dim $strPath, $ChrW, $GetPSTPath $objOL = ObjCreate("Outlook.Application") $objNS = $objOL.GetNameSpace("MAPI") For $objFolder In $objNS.Folders If $objFolder.Name = "Personal Folders" Then MsgBox(0, "", GetPSTPath($objFolder.StoreID),3) EndIf Next Func GetPSTPath($input) For $i = 1 To StringLen($input) Step 2 $strSubString = StringMid($input, $i, 2) If Not ($strSubString = "00") Then $strPath = $strPath And ChrW("&H" And $strSubString) ; String would be converted here EndIf Next Select Case StringInStr($strPath, ":\") > 0 $GetPSTPath = StringMid($strPath, StringInStr($strPath, ":\") - 1) Case StringInStr($strPath, "\\") > 0 $GetPSTPath = StringMid($strPath, StringInStr($strPath, "\\")) EndSelect EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now