TreeOfPain Posted May 4, 2010 Posted May 4, 2010 non-explicit file location? (created where the autoit script ran, not where you wanted it for the vbs). I'd still prefer the passing via the console (if shared objects/memory not possible in autoit/VBs land) for myself at least, a lot nicer than passing via a file. If it works for you though...
AngloTom Posted May 4, 2010 Author Posted May 4, 2010 Nevermind! I'm an idiot. I'll post solution later. So, here's what worked: 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 Sub runBrowseFolderCapture dim strRunVar, objFile, strFileName, strTextLine, strFolderLoc 'assign file loc strFileName = oUtility.ScriptDir & "\txtFolderLoc.txt" MsgBox strFileName 'create file oFSO.CreateTextFile(strFileName) 'Run the AutoIT compiled EXE strRunVar = oShell.Run("""" & oUtility.ScriptDir & "\browseFolder.exe""", 1, true) MsgBox strRunVar 'Read and assign folder location in text file to variable Set objFile = oFSO.OpenTextFile(strFileName, ForReading) 'MsgBox "Before read" strTextLine = objFile.ReadLine 'MsgBox strTextLine objFile.Close 'Delete the file oFSO.DeleteFile(strFileName) 'assign folder location variable to HTA page text box fileNameCapture.value = strTextLine End Sub
AngloTom Posted May 4, 2010 Author Posted May 4, 2010 So, here's what worked: 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 Sub runBrowseFolderCapture dim strRunVar, objFile, strFileName, strTextLine, strFolderLoc 'assign file loc strFileName = oUtility.ScriptDir & "\txtFolderLoc.txt" MsgBox strFileName 'create file oFSO.CreateTextFile(strFileName) 'Run the AutoIT compiled EXE strRunVar = oShell.Run("""" & oUtility.ScriptDir & "\browseFolder.exe""", 1, true) MsgBox strRunVar 'Read and assign folder location in text file to variable Set objFile = oFSO.OpenTextFile(strFileName, ForReading) 'MsgBox "Before read" strTextLine = objFile.ReadLine 'MsgBox strTextLine objFile.Close 'Delete the file oFSO.DeleteFile(strFileName) 'assign folder location variable to HTA page text box fileNameCapture.value = strTextLine End Sub Ok so that didn't work in WinPE. I'll start another thread though, since it is not related to this one. ~AngloTom
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