URL: https://www.overclockers.at/coding-stuff/vbscript-dateiauswahl-dialog_223316/page_1 - zur Vollversion wechseln!
ich scheitere grade daran, einen dateiauswahldialog zu basteln. nach langem rungooglen bin ich auf BrowseForFolder gestoßen, und ich kann mir die struktur damit zwar anzeigen lassen und ordner auswählen, aber keine files.
Code: VBdim objshell, retPath set objshell = CreateObject("Shell.Application") set retPath = objshell.BrowseForFolder(0,"Datei Wählen", &H4241,17) MsgBox retPath
Nur eine Vermutun, hab keine Ahnung von der vbscript API:
?Code: VBobjshell.BrowseForFile
?Code: VBSet objDialog = CreateObject("UserAccounts.CommonDialog") 'objDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*" objDialog.Filter = "All Files|*.*" objDialog.FilterIndex = 1 objDialog.InitialDir = "C:\Temp" nResult = objDialog.ShowOpen If nResult = 0 Then MsgBox "Cancel" Else MsgBox objDialog.FileName End If
tjaa browseforfile gibts leider nicht
und es sollte unter Win7 laufen.
von http://www.robvanderwoude.com/vbstech_ui_fileopen.php (3. Hit http://www.google.com/search?q=file+dialog+in+vbscriptCode: VBOption Explicit WScript.Echo "Selected file: " & ChooseFile( ) Function ChooseFile( ) ' Select File dialog based on a script by Mayayana ' Known issues: ' * Tree view always opens Desktop folder ' * In Win7/IE8 only the file NAME is returned correctly, the path returned will always be C:\fakepath\ ' * If a shortcut to a file is selected, the name of that FILE will be returned, not the shortcut's On Error Resume Next Dim objIE, strSelected ChooseFile = "" Set objIE = CreateObject( "InternetExplorer.Application" ) objIE.visible = False objIE.Navigate( "about:blank" ) Do Until objIE.ReadyState = 4 Loop objIE.Document.Write "<HTML><BODY><INPUT ID=""FileSelect"" NAME=""FileSelect"" TYPE=""file""><BODY></HTML>" With objIE.Document.all.FileSelect .focus .click strSelected = .value End With objIE.Quit Set objIE = Nothing ChooseFile = strSelected End Function
ja die seite hab ich auch gefunden, nur die 2 oberen funktionierten nicht und beim 3. hab ich nur InternetExplorer gelesen und gedacht, das sei so für mich nicht anwendbar.
naja.. hinhauen tut das ja dennoch nicht, da er den pfad nicht liefert.
overclockers.at v4.thecommunity
© all rights reserved by overclockers.at 2000-2025