MadBoy Posted March 18, 2006 Share Posted March 18, 2006 (edited) What i want autotit code to do is the same thing as SetDevicePath.exe does. And what is does i will show on example. Lets say you've got your drivers in dir D:\Drivers. There you have couple of dirs in those dirs you have more dirs etc. My drivers dir looks like this (more or less) ----------------------- D:\Drivers D:\Drivers\Maxdata D:\Drivers\Maxdata\3200X D:\Drivers\Maxdata\7000X D:\Drivers\IBM D:\Drivers\IBM\Something D:\Drivers\HP D:\Drivers\HP\NX6110 D:\Drivers\HP\NX6120 ----------------------- Now when you type SetDevicePath d:\Drivers it will go thru that dir and every path it finds is added to registry under following key: "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath" On default system this line looks like: ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath", "REG_EXPAND_SZ", "%SystemRoot%\inf") Now after SetDevicePath is used that registry entry looks like: %SystemRoot%\Inf;d:\Drivers\Maxdata\3100X;d:\Drivers\Maxdata;d:\Drivers\HP\NX6110;d:\Drivers\HP Hope it's more clear now and someone will be able to help me. I did some code but it sucks. Func DevicePath($path_to_drivers) $DirListDir1 =_FileListToArray($path_to_drivers, "*", 2) If $DirListDir1[0] > 0 Then $DirListDir2 = _FileListToArray($path_to_drivers & "\" & $DirListDir1[1], "*", 2) EndIF If $DirListDir2[0] > 0 Then $DirListDir3 = _FileListToArray($path_to_drivers & "\" & $DirListDir1[1] & "\" & $DirListDir2[1], "*", 2) EndIF If $DirListDir3[0] > 0 Then $DirListDir4 = _FileListToArray($path_to_drivers & "\" & $DirListDir1[1] & "\" & $DirListDir2[1] & "\" & $DirListDir3[1], "*", 2) EndIf ;MsgBox(0, "Information", $path_to_drivers & "\" & $DirListDir1[1] & "\" & $DirListDir2[1] & "\" & $DirListDir3[1] & "\") EndFunc Edited March 18, 2006 by MadBoy My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
MadBoy Posted March 18, 2006 Author Share Posted March 18, 2006 Did some edit to make it more clear. Hope you guys can help with this. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
MHz Posted March 19, 2006 Share Posted March 19, 2006 Should be able to use a similar solution to the last task I helped you with. Use StdOutRead with the Dir command. Dir has switches which can get folder names and subfolder names very promptly. You then replace the end of line chars with semi-colons and add it to the string that already exists. Link to comment Share on other sites More sharing options...
MadBoy Posted March 19, 2006 Author Share Posted March 19, 2006 (edited) Should be able to use a similar solution to the last task I helped you with. Use StdOutRead with the Dir command. Dir has switches which can get folder names and subfolder names very promptly. You then replace the end of line chars with semi-colons and add it to the string that already exists.Nice, i managed to get it to working but DIR command outputs something like that: Katalog: e:\Drivers\HP\NX6110 Katalog: e:\Drivers\Maxdata\3100X How to remove Katalog: if i DON'T want it to be language related (in other lang Katalog will be Catalog or some other name). Constant thing here that will always be here is e:\Drivers in this example as i paste it thru $variable. Tried reading on StringTrimLeft but i have to give exact number of chars and it will change from version to version. Maybe there's a better way... [sOLVED] by using $dupa = StringSplit($DirSplit[$i], ": ",1) Tnx again Mhz! Your help was VERY VERY GOOD! Edited March 19, 2006 by MadBoy My little company: Evotec (PL version: Evotec) 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