emmanuel Posted August 18, 2004 Share Posted August 18, 2004 I'd like to split a string from an INI file:[Global] List="c:\test.mdb","c:\test2.mdb" into a script to run the /Compact command on a list of mdb's that can be changed by the users. here's what I have so far:$sMdbIni = IniRead("CompactMDB.ini", "Global", "List", "c:\test.mdb") $sMdbList = StringSplit($sMdbIni, ",") For $i = 1 to $sMdbList[0] MsgBox(4096,'debug:' , '$sMdbList:' & $sMdbList[$i]);### Debug MSGBOX compactMDB ($sMdbList[$i]) Next func CompactMDB ($sMdb) $ACCESSPATH = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msaccess.exe", "") $iMdbRun = RunWait('"' & $AccessPath & '" /compact "' & $sMdb & '"') MsgBox(4096,'debug:' , '$iMdbRun:' & $iMdbRun);### Debug MSGBOX EndFunc The problem is that either the INI read or StringSplit are doing odd things with the quotes around the filenames, the debug shows: --------------------------- debug: --------------------------- $sMdbList:c:\test.mdb" --------------------------- OK ---------------------------Shouldn't it show "c:\test.mdb" ? "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
emmanuel Posted August 18, 2004 Author Share Posted August 18, 2004 Nevermind, I just took the quotes out of the ini file and it works, even with spaces. And I don't think commas are legal in filenames, so hopefully we don't run into that. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Valik Posted August 18, 2004 Share Posted August 18, 2004 Actually, commas are legal in file names. The way around the issue, though, is this: [Global] List=""c:\test.mdb","c:\test2.mdb"" You might consider using | for your delimiter as it is an invalid character in a file name. Then you don't have to use quotes at all. Link to comment Share on other sites More sharing options...
emmanuel Posted August 18, 2004 Author Share Posted August 18, 2004 Actually, commas are legal in file names. The way around the issue, though, is this: [Global] List=""c:\test.mdb","c:\test2.mdb"" You might consider using | for your delimiter as it is an invalid character in a file name. Then you don't have to use quotes at all. <{POST_SNAPBACK}>excellent, changed it to | Thanks Valik "I'm not even supposed to be here today!" -Dante (Hicks) 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