Jump to content

editing comdlg32 open dialog


MCT

Recommended Posts

ive got the following reg file..

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies]
"NoFileMru"=dword:00000001
"NoBackButton"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ComDlg32]

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar]
"Place0"="G:\\"
"Place1"="C:\\"
"Place2"="C:\\Documents and Settings\\Administrator\\Desktop\\Wallpapers"
"Place3"="C:\\Documents and Settings\\Administrator\\My Documents\\My Pictures"

which works, but how can i get a list of all hdds & set them unattended? its probly something simple...i just cant figure it out :P

Link to comment
Share on other sites


you could try copying a text file to the root of every hdd like

copy /y %DVD%\hdd.txt d:\
copy /y %DVD%\hdd.txt e:\
copy /y %DVD%\hdd.txt f:\
.
.
.

and afterwards you look for it, like:

IF EXIST d:\hdd.txt REG ADD...
.
.
.

this is similar to the method used to discover the driveletter of the DVD/CD drive.

its propably not the best solution, but it should work

Link to comment
Share on other sites

i was gonna do that, but i thought.. during unattended install if you have a floppy or other recordable media in the pc, it would copy that file there, thus leaving u stranded :P

Link to comment
Share on other sites

Here is a (messy) suggestion

This vbs will return a list of all fixed drives.

'Drives.vbs
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
  if (d.DriveType = 2) Then ltr = ltr & vbCrLf & d.DriveLetter
Next
WSCript.Echo ltr

A sample.cmd for usage

@echo off
cscript //nologo drives.vbs>drives.list
FOR /F %%i in (drives.list) do echo Maybe use reg add on this line: %%i
pause

Link to comment
Share on other sites

And here's the not so messy vbs file :):

Set Shell = CreateObject("WScript.Shell")
Set FSO   = CreateObject("Scripting.FileSystemObject")

I = 0

For Each Drive in FSO.Drives
  If Drive.DriveType = 2 Then
    Shell.RegWrite "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar\Place" & I, Drive.DriveLetter & ":\"
    I = I + 1
  End If
Next

No external files needed, just run it from anywhere you like :)

Edit: Replaced the double slashes with one slash.

Link to comment
Share on other sites

@Tsunami

yours doesnt work, i havent tested nakira's yet, but with yours it just erases the preset 1s :(

any ideas how 2 fix it since i dont know vbs :P

thanks :D

EDIT: nakiras doesnt work either :( it adds the value "C:\\" so it doesnt register

Link to comment
Share on other sites

nakiras doesnt work either  it adds the value "C:\\" so it doesnt register

Ehm, The vbscript and sample.cmd I gave didn't add anything, they only echoed some text along with the drive letter (e.g. C), no ":\\" at all anywhere. Any added would be from your code. ;)

Anyway try this cmdfile along with the vbsfile from my earlier post.

This seeks the current places, and adds all drive letters as entries from the last existing entry it finds.

That is, you already have

"Place0"="G:\\"

"Place1"="C:\\"

"Place2"="C:\\Documents and Settings\\Administrator\\Desktop\\Wallpapers"

"Place3"="C:\\Documents and Settings\\Administrator\\My Documents\\My Pictures"

So this would add from Place4 onwards for as many drives as you have (with Place4 being C:\ again :D)

I don't know how many PlaceS you want though, you already have 4 and AFAIK only 5 are valid. *shrug*

REM Addplaces.cmd
@echo off
setlocal ENABLEDELAYEDEXPANSION
set cnt=-2
for /f %%i in ('reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\comdlg32\PlacesBar /s') do (
set /A cnt+=1
)
cscript //nologo drives.vbs>drives.list
FOR /F %%i in (drives.list) do (
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\ComDlg32\PlacesBar /v Place!cnt! /d %%i:\ /f
set /A cnt+=1
)
del drives.list

Link to comment
Share on other sites

@Tsunami

yours doesnt work, i havent tested nakira's yet, but with yours it just erases the preset 1s :(

any ideas how 2 fix it since i dont know vbs :P

thanks :D

EDIT: nakiras doesnt work either :( it adds the value "C:\\" so it doesnt register

Yes, it replaces the presets, but your reg file does that too. I tested it on my HKCU key, because I disabled the Places bar, but I'll reenable it and see if I can change it so it will add places instead of overwriting them.

Edit: Alright, I misunderstood you. I thought you meant it erased the default places, but you meant it wasn't showing any places at all. I just tested it, and apparently you don't need the two slashes in a vbs file. Use one slash and it will work.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...