geezery Posted June 6, 2007 Author Share Posted June 6, 2007 p4ntb0y->Do you know how I can get this dialog to work on Winpe v2. It works on Windows XP, but not on WinPe based system.Here is the full sub, just make a button to call it. I also tried BrowseForFolder method and safrcdlg.CommonDialog and none of them work in Winpe. I noticed that in winpe's notepad there is a nice dialog when opening files. I wonder how I can call it?'****************************************************************************'* Browse Folder Button'****************************************************************************Sub Browse Dim objDialog, FilePath, JustPath, objFile Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = "Wim Files|*.wim|All Files|*.*" objDialog.FilterIndex = 1 objDialog.InitialDir = myFilePath FilePath = objDialog.ShowOpenIf FilePath = 0 Then Exit SubElse FilePath = objDialog.FileName Set objFile = objFSO.GetFile(FilePath) MyFilePath = objFSO.GetParentFolderName(FilePath) & "\" Window_OnloadEnd IfEnd SubSolutionone ->Here is the code for the diskpart.If you find a way to make it readable that would be nice. Maybe you can try to Replace " " empty chars with vbTab or something:)Sub VolumesDim oExec,OShell, listSet oShell = CreateObject("WScript.Shell")Set oExec = oShell.Exec("diskpart")oExec.StdIn.Write "list volume" & VbCrLfoExec.StdIn.Write "exit" & VbCrLflist = Trim(OExec.StdOut.ReadAll)msgbox(list)End SubI'll try to find time to test this on Vistape, but I would first like to get some more features working. Link to comment Share on other sites More sharing options...
geezery Posted June 6, 2007 Author Share Posted June 6, 2007 powaking->Can you make a test in VistaPe?Copy this code to notepad and change the filename.wim to your wim filename. Then Save it to same folder where the wim is i. e. test.vbs CAll VolumesSub VolumesDim oExec,OShell, listSet oShell = CreateObject("WScript.Shell")Set oExec = oShell.Exec("imagex /info filename.wim") 'Change filename.wim to your wim filenamelist = Trim(OExec.StdOut.ReadAll)msgbox(list)End SubExecute the script. You should get a msgbox containing the wim info. Try this in the VistaPE. Link to comment Share on other sites More sharing options...
ccb458 Posted June 6, 2007 Share Posted June 6, 2007 It seems that everything works, but suddenly, I realized the background image is gone!Below is what I have, Geezrey, you used to put in the older version:<Body background="pe.jpg">that no longer works (I just have a grey background). Then I modify your lines as follows:<BODY><DIV id=bg>img src="e:\pe.jpg"></DIV>What happens is I have the image at the top of the screen, and the selection comes below the image, not in the image. Do you know why?thx Link to comment Share on other sites More sharing options...
geezery Posted June 6, 2007 Author Share Posted June 6, 2007 Yes I know. I added some parameter also to the .css file replace the .css file with the old one and it should work. Or look at the Body section in the css. Link to comment Share on other sites More sharing options...
powaking Posted June 6, 2007 Share Posted June 6, 2007 (edited) powaking->Can you make a test in VistaPe?Copy this code to notepad and change the filename.wim to your wim filename. Then Save it to same folder where the wim is i. e. test.vb script: test.vbsTried it but got this error:Line: 6Char: 1Error: The system cannot find the file specifiedCode: 800700002Source: WshShell.ExecI even issued a cscript //H:WScript for giggles and got the same results.BUTI then relealized I hadn't copied the required wim files into the system32. Once I did that then I got the msgbox displaying the WIMs information. So looks like we are heading in the right direction.Now just need to make a plugin for Vistape to copy these files to the system32 folder (so I don't have to manually do it each and every time).Edit:If I add this:Do While Not oExec.StdOut.AtEndOfStream sReadLine = oExec.StdOut.ReadLine pos = Instr(1, sReadLine, "<DESCRIPTION>", 1) if pos = 0 then else msgbox pos end if loopTo the Test.vbs all I get is 5 for the value of pos.Edit #2: (Sorry but I think this is it and we can work from here)This works. It displays the Image number, description and nameCAll VolumesRedim strNames(0)Redim strIndx(0)Redim strDesc(0)Sub VolumesDim oExec,OShell, listSet oShell = CreateObject("WScript.Shell")Set oExec = oShell.Exec("imagex.exe /info i:\vistape\MyWim.wim") Do While Not oExec.StdOut.AtEndOfStream sReadLine = oExec.StdOut.ReadLine pos = Instr(1, sReadLine, "<NAME>", 1) pos2 = Instr(1, sReadLine, "<IMAGE ", 1) pos3= Instr(1, sReadLine, "<DESCRIPTION>", 1) If pos2 > 0 Then i = i + 1 Redim Preserve strIndx(i) Redim Preserve strNames(i) Redim Preserve strDesc(i) strDesc(i) = "NO DESCRIPTION" tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13)) strIndx(i) = Left(tmpStr1, Len(tmpStr1) -3) 'increased to 3 to remove the additional " msgbox strIndx(i) End If If pos > 0 Then tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5)) strNames(i) = Left(tmpStr1, Len(tmpStr1) -8) msgbox strNames(i) End If If pos3 > 0 Then tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos3 + 12)) strDesc(i) = Left(tmpStr1, Len(tmpStr1) -15) msgbox strDesc(i) End If loopEnd SubWhen I incorporated this into your hta I still don't get the information in the hta. Edited June 6, 2007 by powaking Link to comment Share on other sites More sharing options...
powaking Posted June 6, 2007 Share Posted June 6, 2007 p4ntb0y->Do you know how I can get this dialog to work on Winpe v2. It works on Windows XP, but not on WinPe based system.Here is the full sub, just make a button to call it. I also tried BrowseForFolder method and safrcdlg.CommonDialog and none of them work in Winpe. I noticed that in winpe's notepad there is a nice dialog when opening files. I wonder how I can call it?'****************************************************************************'* Browse Folder Button'****************************************************************************Sub Browse Dim objDialog, FilePath, JustPath, objFile Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = "Wim Files|*.wim|All Files|*.*" objDialog.FilterIndex = 1 objDialog.InitialDir = myFilePath FilePath = objDialog.ShowOpenIf FilePath = 0 Then Exit SubElse FilePath = objDialog.FileName Set objFile = objFSO.GetFile(FilePath) MyFilePath = objFSO.GetParentFolderName(FilePath) & "\" Window_OnloadEnd IfEnd SubHave you taken a look here? http://www.visualbasicscript.com/m_36250/tm.htm Link to comment Share on other sites More sharing options...
powaking Posted June 6, 2007 Share Posted June 6, 2007 (edited) I hardcoded this line to the hta file:Set oExec = oShell.Exec("imagex.exe /info " + strFile)to thisSet oExec = oShell.Exec("imagex.exe /info m:\vistape\mywim.wim")One I did that I was able to view that wims image number and description.It appears it has something to do with this: Set objSel1 = window.document.getElementById("select1")strFile = myFilepath + objSel1.options(objSel1.selectedindex).text?? Edited June 6, 2007 by powaking Link to comment Share on other sites More sharing options...
zorphnog Posted June 6, 2007 Share Posted June 6, 2007 Ok, I haven't looked at the source code, but if you copied that directly the +'s should be &'s. Thats just strictly from a vbscripting perspective. Link to comment Share on other sites More sharing options...
powaking Posted June 6, 2007 Share Posted June 6, 2007 I think I found the issue. My file path was set to M:\vistape. After doing some msgbox's I realized it should have been M:\Vistape\. Once I added the last \ it then processed my wim files. Feel sooooo stupid Link to comment Share on other sites More sharing options...
solutionone Posted June 6, 2007 Share Posted June 6, 2007 (edited) After much thought about getting rid of the diskpart.txt file, when using the apply function. I thought of another way we would possibly do this better.Instead of having the static diskpart.txt file, we could create the diskpart.txt file actually in the HTA dynamically line by line.somebody could even write in some logic paths into the code, e.g. how many partitions do you wish to create, what size do you want to make the partitions. (unfortunately I'm not a scripter/programmer at all, so I found this sample code, but I'm not sure if it will work, so how to implement it) The code could be set to delete the diskpart.txt everytime imagex.hta is refreshed.<%dim filesys, filetxt, getname, pathSet filesys = CreateObject("Scripting.FileSystemObject")Set filetxt = filesys.CreateTextFile("x:\windows\system32\diskpart.txt", True)path = filesys.GetAbsolutePathName("x:\windows\system32\diskpart.txt")getname = filesys.GetFileName(path)filetxt.WriteLine("Your text goes here.")filetxt.CloseIf filesys.FileExists(path) Then Response.Write ("Your file, '" & getname & "', has been created.")End If%>EDITHaha, I figured out the "diskpart list volume" formatting issue, I'll post my findings in the morning. Its been a long day.... I think my plan will be a pretty cool addition, and I've figured out most of the coding. Edited June 7, 2007 by solutionone Link to comment Share on other sites More sharing options...
solutionone Posted June 7, 2007 Share Posted June 7, 2007 p4ntb0y->Do you know how I can get this dialog to work on Winpe v2. It works on Windows XP, but not on WinPe based system.Here is the full sub, just make a button to call it. I also tried BrowseForFolder method and safrcdlg.CommonDialog and none of them work in Winpe. I noticed that in winpe's notepad there is a nice dialog when opening files. I wonder how I can call it?Geezery, in regards to the dialog in notepad, have a look at this pagehttp://msdn2.microsoft.com/en-us/library/bb397401.aspxright at the bottom of the page is the "New Shell Functions under Vista", you will note a link to a downloadable help file that will give you the answers you need. Link to comment Share on other sites More sharing options...
geezery Posted June 7, 2007 Author Share Posted June 7, 2007 Looks promising. I think I can find something there. Thank you for the tip.About the diskpart. I think that it is possible to make it without the text files, but making the script takes a lot of time and effort. Has anyone else had any problems with the diskpart active command, because I notices that it won't take effect on my script? Link to comment Share on other sites More sharing options...
solutionone Posted June 7, 2007 Share Posted June 7, 2007 Can you give me a detailed plan/outline, of what exactly you want the diskpart to do for the applying image system.What prompts do you want the user to get, etc. I know a VBscripter who has a lot of time on his hands at the moment and would be happy to make the coding for you in respect to this. Link to comment Share on other sites More sharing options...
geezery Posted June 7, 2007 Author Share Posted June 7, 2007 It would be nice to have a separate HTA. The dialogs could be something like the windows txtmode diskpart section. If you get what I mean. Link to comment Share on other sites More sharing options...
powaking Posted June 7, 2007 Share Posted June 7, 2007 You check this out for drive mapping?http://www.ss64.com/wsh/drivemap.htmlBe nice to prompt to map a drive first. 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