Jump to content

Recommended Posts

Posted (edited)

Here's the script:

browseFolder()

Func browseFolder()
$var = FileSelectFolder("Choose a folder.", "")
$txtLoc = @ScriptDir & "\txtFolderLoc.txt"
$file = FileOpen($txtLoc, 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, $var)

FileClose($file)

EndFunc

When compiled and ran in WinPE, nothing happens. No error dialogs, not even a process is visible in Task Manager. The return code, however, is 0. Any ideas why this won't work in WinPE?

~AngloTom

Edited by AngloTom
Posted

Here's the script:

browseFolder()

Func browseFolder()
$var = FileSelectFolder("Choose a folder.", "")
$txtLoc = @ScriptDir & "\txtFolderLoc.txt"
$file = FileOpen($txtLoc, 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($file, $var)

FileClose($file)

EndFunc

When compiled and ran in WinPE, nothing happens. No error dialogs, not even a process is visible in Task Manager. The return code, however, is 0. Any ideas why this won't work in WinPE?

~AngloTom

Ok so I simplified the script to:

$var = FileSelectFolder("Choose a folder.", "")

... compiled it to an exe, and it still doesn't work in WinPE. Nothing happens... no error screen anything. Any ideas? Should I use dependency walker on it and include any missing DLLs in my WinPE image?

Posted

Ok so I read this thread:

http://www.autoitscript.com/forum/index.php?showtopic=3040&hl=FileSelectFolder%20WinPE&st=0

... and decided to use the FileSaveDialog function instead.

Posted

Any ideas why this won't work in WinPE?

With WinPE i assume you use WinPE 2 (Vista) or WinPE 3 (Seven)?

If so, you just missing the Desktop folder.

One solution create this folder before you use FileSelectFolder

If Not FileExists(@UserProfileDir & '\Desktop') Then DirCreate(@UserProfileDir & '\Desktop')

Other way is to show the My Computer in the root of the folder tree

$var = FileSelectFolder("Choose a folder.", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
Posted

With WinPE i assume you use WinPE 2 (Vista) or WinPE 3 (Seven)?

If so, you just missing the Desktop folder.

One solution create this folder before you use FileSelectFolder

If Not FileExists(@UserProfileDir & '\Desktop') Then DirCreate(@UserProfileDir & '\Desktop')

Other way is to show the My Computer in the root of the folder tree

$var = FileSelectFolder("Choose a folder.", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")

Awesome, I will give that a shot. Thanks for the info.
Posted

Does anyone else have any other suggestions or ideas? I have tried the two suggestions listed above and neither seem to fix the empty browse window for me. I verified the specified profile folder is being created in WinPE and that the browse window does start on "my computer" on a windows 7 box (I am unable to tell on WinPE since it the browse windows doesn't populate.) I am using WinPE 3.

Any ideas would be greatly appreciated... I've been tearing my hair out about this for a couple weeks now and was about to break down and write my own save dialog in HTA but would prefer to avoid that if possible.

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
×
×
  • Create New...